Mugo Web main content.

How to use Composer to set up an eZ Publish install

By: Philipp Kamps | June 26, 2013 | eZ Publish development tips

Composer is a dependency management tool for PHP that eZ Publish 5 uses. The following is simple step-by-step how-to on using Composer to install eZ Publish (legacy) with additional extensions.

1) If you haven't already, install Composer.

2) Then, we need to install eZ Publish. We use Composer and specify the "ezsystems/ezpublish-legacy" package and the destination folder ezp. The last parameter specifies the code tag, which in this case is the eZ Publish version.

composer create-project ezsystems/ezpublish-legacy ezp v2013.06.0

In the output of the command, you will see that composer installed eZ Publish with its dependencies into the ezp directory. The zeta components are still missing and you would need to install them separately.

3) With Composer there are multiple ways to add an eZ Publish extension to your setup. Let's pick just one: adding an extension directly from GitHub. To do this, you need to edit the composer.json file in your eZ Publish root directory ezp:

    "name":        "ezsystems/ezpublish-legacy",
    "description": "eZ Publish LegacyStack (4.x)",
    "homepage":    "",
    "license":     "GPL-2.0",
    "type":        "ezpublish-legacy",
    "repositories": [
            "type": "vcs",
            "url": ""
    "require": {
        "php": ">=5.3.3",
        "ezsystems/ezpublish-legacy-installer": "*",
        "mugoweb/data_import" : "dev-master"
    "extra": {
        "branch-alias": {
            "dev-master": "5.2.x-dev"

Comparing this configuration with the original version, you will see that a "repository" was added. In the "require" setting, we map "mugoweb/data_import" (the name of the extension as will be found in the repository) to "dev-master". "dev-master" specifies that you want to get the code from the master branch. For stability reasons, you might want to use a release tag instead. The data_import extension contains and requires its own composer.json file - see more later.

4) Run the following command inside the ezp folder to tell Composer to read the new configuration and install the extension:

composer update

5) You now should see a new directory data_import under the extension directory. You still need to follow the extension installation instructions such as enabling the extension in an override of site.ini.

Making your extensions installable with Composer

If you are an eZ Publish extension author, you can add Composer support to your extension(s) pretty easily.

In the root directory of your eZ Publish extension, create a composer.json file. Here is the file from the "data_import" extension as an example:

    "name": "mugoweb/data_import",
    "description": "eZ Publish extension for importing and migrating content",
    "type": "ezpublish-legacy-extension",
    "license": "GPL-2.0",
    "authors": [
            "name": "Philipp Kamps"
    "require": {
        "ezsystems/ezpublish-legacy-installer": "*"


With Composer, you have a central location to manage versions of eZ Publish code and related extensions. It has the potential to simplify and speed up the installation process. Also, it should be easy to update (with "composer update") an eZ Publish extension's files.

Thanks to Jérôme Vieilledent from eZ Systems for his video presentation on how to use Composer to install eZ Publish, which inspired this post.