2017 © Pedro Peláez
 

composer-plugin composer-plugin

Composer plugin that provides installers for contao-module and legacy-contao-module.

image

contao-community-alliance/composer-plugin

Composer plugin that provides installers for contao-module and legacy-contao-module.

  • Sunday, July 22, 2018
  • by xtra
  • Repository
  • 18 Watchers
  • 6 Stars
  • 126,941 Installations
  • PHP
  • 817 Dependents
  • 0 Suggesters
  • 9 Forks
  • 12 Open issues
  • 45 Versions
  • 7 % Grown

The README.md

Contao Composer Plugin

Version License Downloads, (*1)

The Contao Composer plugin is responsible for correctly installing Contao 3 extensions in a Composer environment. Composer files are always located in the vendor folder, but they must be copied/symlinked to system/modules to be correctly detected by Contao., (*2)

Be aware that this plugin is not necessary for Contao 4 / Symfony bundles. If you however do support both Contao 3 and Contao 4, make sure to follow the old way which is still fully supported in Contao 4. You will obviously not be able to use new bundle features (like the DIC) though., (*3)

composer.json

Follow the Composer manual on how the basic composer.json in your library should look like., (*4)

A few simple rules will make your package compatible with Contao 3:, (*5)

  1. Change the type of your package to contao-module
  2. Add a requirement for the correct Contao version
  3. Add a requirement to the Contao Composer plugin
  4. Add the sources to the extras => contao section
  5. If necessary, specify your runonce files

Example:, (*6)

{
    "name": "vendor/package-name", 
    "type": "contao-module",
    "license": "LGPL-3.0+",
    "require": {
        "contao/core-bundle": "4.*",
        "contao-community-alliance/composer-plugin": "3.*"
    },
    "extra": {
        "contao": {
            "sources": {
                "": "system/modules/extension-name"
            },
            "runonce": [
                "config/update.php"
            ]
        }
    },
    "replace": {
        "contao-legacy/extension-name": "self.version"
    }
}

Require Contao

In Contao 4, the bundled modules were restructured so each module is a separate Symfony bundle. This means that a user can decide not to install the news or calendar extension if it's not needed for their system., (*7)

Your extension should always require contao/core-bundle in the appropriate version (see About semantic versioning). If your code is extending other modules like news or calendar, make sure to add correct requirements for the respective Symfony bundles (e.g. contao/news-bundle or contao/calendar-bundle)., (*8)

Contao 4 was designed to be backwards-compatible with Contao 3. Therefore, it is very much possible to have an extension that does support both Contao 3 and Contao 4. If your extension works with Contao 3.5 and Contao 4, a correct requirement could look like this:, (*9)

{
    "require": {
        "contao/core-bundle": "~3.5 || ~4.1"
    }
}

Require the Contao Composer Plugin

There are two different versions of the Plugin currently actively supported., (*10)

  • Version 2 of the plugin is made for Contao 3. It supports installing Composer packages in TL_ROOT/composer instead of the root directory of your installation., (*11)

  • Version 3 of the plugin is made for Contao 4. In Contao 4, the vendor folder is located in your installation root, and Contao is just another dependency of your installation., (*12)

Make sure to require the correct version of the plugin. If your module does support Contao 3 and Contao 4, the correct require statement looks like this:, (*13)

{
    "require": {
        "contao-community-alliance/composer-plugin": "~2.4 || ~3.0"
    }
}

Versions older than 2.4 will not support contao/core-bundle, so make sure to set a correct dependency. If you only support Contao 4, the required version would simply be 3.*. However, you should probably create a Symfony bundle and not require the Contao Composer Plugin at all…, (*14)

Be aware that your root project (the composer.json in your root folder) should be of type project, otherwise the plugin will not install Contao sources., (*15)

Sources

In the sources section, you can define which files should be copied where on installation. This is necessary for Contao 3 extensions to be installed in the system/modules folder., (*16)

If your GIT repository contains only files that should be copied into the system/modules/extension-name folder, simply specify an empty source and the target folder., (*17)

{
    "extra": {
        "contao": {
            "sources": {
                "": "system/modules/extension-name"
            }
        }
    }
}

However, you could also restructure your GIT so that Contao files live in their own folder. In this case, you can use the Composer autoloader and follow PSR-0 or PSR-4 namespaces. However, your extension is then incompatible with the old extension repository., (*18)

You can define multiple files or folder to be copied/symlinked into the Contao installation. Your package can even install multiple Contao extensions at once., (*19)

{
    "extra": {
        "contao": {
            "sources": {
                "config": "system/modules/extension-name/config",
                "dca": "system/modules/extension-name/dca",
                "templates": "system/modules/extension-name/templates"
            }
        }
    },
    "autoload": {
        "psr-4": {
            "VendorName\\ExtensionName\\": "src/"
        }
    }
}

Userfiles

The userfiles property allows to copy files from a Composer package to the /files folder in Contao. As this folder can be renamed in the Contao configuration, the installer automatically tries to find the correct location., (*20)

Be aware that userfiles are only copied once if they do not exist, they are not overwritten on an update., (*21)

{
    "extra": {
        "contao": {
            "userfiles": {
                "src/system/modules/my-module/files/images": "my-module/images"
            }
        }
    }
}

Runonces

Putting runonce.php files into your extension's config directory is a bad practice with Composer. The file will be deleted by Contao after it's executed, which means Composer will complain about modified files on the next update. To work around this, you can specify a list of runonce files in the composer.json. They will be executed after each installation or update, but they won't be deleted. There is no need to name them runonce.php either, feel free to use any other name., (*22)

{
    "extra": {
        "contao": {
            "runonce": [
                "src/system/modules/extension-name/runonce/init_update.php",
                "src/system/modules/extension-name/runonce/do_db_update.php",
                "src/system/modules/extension-name/runonce/refresh_entities.php"
            ]
        }
    }
}

The runonce files will be executed in the order you specify them., (*23)

About semantic versioning

Following Semanting Versioning is crucial to the success of Composer installation. If you (the developer) do not follow semantic versioning, it is very hard for others, (and the dependency manager) to install correct versions of your library., (*24)

You should also get familiar with the Composer version constraints to correctly set your dependencies. Incorrect dependencies will lead to broken installations, and it's always the developer's fault!, (*25)

Server requirements

The Contao Composer Plugin requires an up-to-date server configuration. Contao 4 does no longer support the so-called "safe mode hack", and the plugin now requires symlink support., (*26)

The Versions

22/07 2018

dev-develop

dev-develop http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

22/07 2018

dev-master

9999999-dev http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

22/07 2018

3.0.9

3.0.9.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

22/07 2018

dev-hotfix/3.0.9

dev-hotfix/3.0.9 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

12/09 2017

3.0.8

3.0.8.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

05/09 2017

3.0.7

3.0.7.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

23/08 2017

3.0.6

3.0.6.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

29/05 2017

dev-hotfix/3.0.6

dev-hotfix/3.0.6 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

25/04 2017

3.0.5

3.0.5.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

25/04 2017

dev-hotfix/3.0.5

dev-hotfix/3.0.5 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

27/03 2017

dev-hotfix/2.4.4

dev-hotfix/2.4.4 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

14/12 2016

dev-hotfix/issue-62

dev-hotfix/issue-62 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

02/11 2016

3.0.4

3.0.4.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

11/08 2016

3.0.3

3.0.3.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

04/07 2016

dev-support/2.4

dev-support/2.4 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

04/07 2016

2.4.3

2.4.3.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

24/05 2016

3.0.2

3.0.2.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

24/05 2016

2.4.2

2.4.2.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

16/02 2016

2.4.1

2.4.1.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

16/02 2016

3.0.1

3.0.1.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

05/02 2016

3.0.0

3.0.0.0 http://c-c-a.org/

Composer plugin that provides installers for contao-module and legacy-contao-module.

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

05/02 2016

2.4.0

2.4.0.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

28/10 2015

2.3.8

2.3.8.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

20/10 2015

2.3.7

2.3.7.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

08/10 2015

2.3.6

2.3.6.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

16/06 2015

2.3.5

2.3.5.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

16/06 2015

2.3.4

2.3.4.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api ^1.0

 

The Development Requires

26/11 2014

2.3.3

2.3.3.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api 1.0.0

 

The Development Requires

26/11 2014

2.3.2

2.3.2.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api 1.0.0

 

The Development Requires

17/11 2014

2.3.1

2.3.1.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api 1.0.0

 

The Development Requires

17/11 2014

2.3

2.3.0.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api 1.0.0

 

The Development Requires

08/11 2014

2.2.5

2.2.5.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api 1.0.0

 

The Development Requires

01/11 2014

2.2.4

2.2.4.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api 1.0.0

 

The Development Requires

24/10 2014

2.2.3

2.2.3.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3.2
  • composer-plugin-api 1.0.0

 

The Development Requires

22/07 2014

2.2.2

2.2.2.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

16/07 2014

2.2.1

2.2.1.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

18/06 2014

2.2

2.2.0.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

01/06 2014

2.1

2.1.0.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

28/05 2014

2.0.2

2.0.2.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

08/05 2014

2.0.1

2.0.1.0 http://c-c-a.org/

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

16/04 2014

2.0.0

2.0.0.0

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

16/04 2014

2.0.0-beta4

2.0.0.0-beta4

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

08/04 2014

2.0.0-beta3

2.0.0.0-beta3

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

18/03 2014

2.0.0-beta2

2.0.0.0-beta2

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires

10/03 2014

2.0.0-beta1

2.0.0.0-beta1

Composer plugin that provide contao integration and installer.

  Sources   Download

LGPL-3.0+

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires