Download the PHP package contao-community-alliance/composer-plugin without Composer

On this page you can find all versions of the php package contao-community-alliance/composer-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package composer-plugin

Contao Composer Plugin

Version License Downloads

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.

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.

composer.json

Follow the Composer manual on how the basic composer.json in your library should look like.

A few simple rules will make your package compatible with Contao 3:

  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:

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.

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).

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:

Require the Contao Composer Plugin

There are two different versions of the Plugin currently actively supported.

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:

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…

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.

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.

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.

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.

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.

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.

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

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.

The runonce files will be executed in the order you specify them.

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.

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!

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.


All versions of composer-plugin with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 || ^8.0
composer-plugin-api Version ^2.0
symfony/finder Version ^4.4 || ^5.2 || ^6.0
symfony/process Version ^4.4 || ^5.2 || ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package contao-community-alliance/composer-plugin contains the following files

Loading the files please wait ....