How to use Composer with Marketplace extensions

Aug 22, 2024

Composer is a dependency management tool for PHP. Instead of manually downloading and including libraries in your Concrete project, Composer allows you to define your dependencies and manage them with the command line.

Concrete CMS manages a private Composer repository specifically for packages available in the Concrete CMS Market. Here's how to use it with a Concrete website.

Add the repository Composer configuration to tell Composer to look for packages in the specified Concrete CMS repository.This can be done in two ways:

  1. Using the Composer CLI:
$ composer config repositories.concretecms composer https://composer.concretecms.org

This command adds the Concrete CMS repository to your project's composer.json file under the repositories key.

  1. Or by manually Editing composer.json:
{
  "repositories": {
    "concretecms": {
      "type": "composer",
      "url": "https://composer.concretecms.org"
    }
  }
}

Authorize Composer to access your purchases. Locate your public and private keys either in the Marketplace Site Page for your website or in your website's dashboard (/dashboard/system/basics/marketplace). Once you have your public and private keys, you need to configure Composer to use them for authentication:

$ composer config --global http-basic.dl.market.concretecms.com <public_key> <private_key>

Replace <public_key> and <private_key> with your actual keys. This command sets the authentication credentials globally, meaning they will be used for all projects on your system that interact with this repository.

Download the packages licencsed to your site

$ composer require concretemarket/<your_package>

Replace <your_package> with the actual package name.

Managing Dependencies Once you have configured your composer.json file and authenticated Composer, you can manage your project’s dependencies using standard Composer commands. Here are some common ones:

  • Update Dependencies:

    $ composer update
    

    This command updates all the dependencies to the latest version according to the constraints in composer.json.

  • Install Dependencies:

    $ composer install
    

    This command installs all dependencies listed in the composer.lock file, ensuring a consistent environment across different setups.

Recent Tutorials
Configure Composer to work with a Page Type
Feb 20, 2025
By myq.

Fix the "Unable to load block into composer. You must edit this content from within the context of the page." error message

Restoring deleted pages using advanced search
Jan 16, 2025
By myq.

How to recover deleted pages when there are more than a few to choose from.

How to Automate the Copyright Year
Dec 27, 2024

Learn how to keep your website's copyright year updated automatically in Concrete CMS.

How to change the path of a group of pages
Dec 23, 2024
By myq.

Change the canonical path without breaking things

Bi-directional Express associations
Dec 18, 2024
By myq.

Set up associations between Express entries in both directions

Display Express Data Across Multiple Sites
Dec 17, 2024
By myq.

A guide to configuring Express entities and the Express Entry List block to ensure proper data display across multiple sites.

Improvements?

Let us know by posting here.