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
Redirect all requests to HTTPS
Oct 9, 2024
By myq.

How to follow best practices for a secure web

Upgrade Concrete versions 9.3.1 and 9.3.2
Sep 10, 2024
By myq.

How to get past a bug in versions 9.3.1 and 9.3.2 that prevents upgrading the Concrete core through the Dashboard

How to use Composer with Marketplace extensions
Aug 22, 2024

Composer can be used to manage third-party extensions from the marketplace

Controlling Google Tag Manager Tags Based on Concrete CMS Edit Toolbar Visibility
Aug 13, 2024

This document provides a step-by-step guide on how to control the firing of Google Tag Manager (GTM) tags based on the visibility of the Concrete CMS edit toolbar. It explains how to create a custom JavaScript variable in GTM to detect whether the edit toolbar is present on a page and how to set up a trigger that ensures GTM tags only fire when the toolbar is not visible. This setup is particularly useful for developers and marketers who want to ensure that tracking and analytics tags are not activated during content editing sessions, thereby preserving the accuracy of data collected.

Upgrading Concrete from 8.5 to 9.x
Jun 21, 2024
By myq.

How to avoid problems upgrading from 8.5 to 9.x

How to change the default date format
May 30, 2024
By myq.

Change the format of the default date

Improvements?

Let us know by posting here.