J3.x

Using Composer with Joomla

From Joomla! Documentation

Other languages:
English • ‎español • ‎français • ‎Nederlands • ‎português
Documentation all together tranparent small.png
Under Construction

This article or section is in the process of an expansion or major restructuring. You are welcome to assist in its construction by editing it as well. If this article or section has not been edited in several days, please remove this template.
This article was last edited by MartijnM (talk| contribs) 4 years ago. (Purge)

Info non-talk.png
General Information

Contributor note: New Feature for Joomla! 3.4


Joomla! 
≥ 3.4
version

Composer is a widely used tool for dependency management when utilizing third-party libraries. The Joomla! Project introduced Composer into Joomla 3.4 to easily manage library dependencies in both core and extensions. Composer now a stable product widely used in the PHP community to update libraries that are registered and listed at https://Packagist.org, which serves as a directory of available download packages including the Joomla! Framework packages. In this document you'll find out how the CMS is using Composer and how to update the libraries it loads. Learn more about Composer by visiting https://GetComposer.org.

Where are the Composer files located?

The Composer files are located in

JPATH_ROOT . '/libraries/vendor';

Can you edit files loaded with composer?

No! You should never directly edit any files imported with Composer (including the Joomla! Framework packages.) These are 3rd party libraries and, similar to all core files, should be enhanced by submitting pull requests on the respective project or extended and overridden in the same manner as any other core functionality.

Where are the Joomla! Framework files located?

Each are hosted in a separate repository. You can find them by going to https://github.com/joomla-framework and searching for the appropriate package.

How can I update libraries from Composer?

Download Composer from https://GetComposer.org/download/ and run

composer update --no-dev

This will update all Composer files to the latest versions as allowed in the composer.json file. If you feel that the versions located in the composer.json file are insufficient then update them by submitting a Pull Request. However, remember that Joomla promises backwards compatibility in the CMS through a major series. This includes the Joomla! Framework packages!

Are Composer files autoloading?

All classes loaded via Composer are automatically autoloaded by the CMS.

Can you install any extra libraries via Composer?

Not at the moment in Joomla! 3.4. In the longer term it is the CMS's aim that you can download extra packages. To emphasize this, we will not yet be releasing the composer.json file within the main Joomla! download.