J3.x

Difference between revisions of "Using Composer with Joomla"

From Joomla! Documentation

(Remove under construction)
(Changed some URL markup. Other markup changes.)
 
Line 5: Line 5:
 
<translate>
 
<translate>
 
<!--T:2-->
 
<!--T:2-->
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.
+
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 the core and extensions. Composer is now a stable product widely used in the PHP community to update libraries that are registered and listed at [https://packagist.org/ Packagist], 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 at the [https://getcomposer.org/ their website].
 
</translate>
 
</translate>
  
 
<translate>
 
<translate>
== Where are the Composer files located? == <!--T:3-->
+
== Where are the Composer Files Located? == <!--T:3-->
 
The Composer files are located in
 
The Composer files are located in
 
</translate>
 
</translate>
  
<source lang="php">
+
<syntaxhighlight lang="php">
 
JPATH_ROOT . '/libraries/vendor';
 
JPATH_ROOT . '/libraries/vendor';
</source>
+
</syntaxhighlight>
  
 
<translate>
 
<translate>
== Can you edit files loaded with composer? == <!--T:4-->
+
== Can You Edit Files Loaded with Composer? == <!--T:4-->
'''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.
+
'''No''' You should never edit any files imported with Composer (including the Joomla! Framework packages). These are third-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.
 
</translate>
 
</translate>
  
 
<translate>
 
<translate>
== Where are the Joomla! Framework files located? == <!--T:5-->
+
== Where are the Joomla! Framework Files Located? == <!--T:5-->
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.
+
Each are hosted in a separate repository. You can find them by going to the [https://github.com/joomla-framework Joomla Framework website] and searching for the appropriate package.
 
</translate>
 
</translate>
  
 
<translate>
 
<translate>
== How can I update libraries from Composer? == <!--T:6-->
+
== How Can I Update Libraries from Composer? == <!--T:6-->
Download Composer from https://GetComposer.org/download/ and run
+
Get Composer from [https://getcomposer.org/download/ their Download page] and run
 
</translate>
 
</translate>
  
<source lang="php">
+
<syntaxhighlight lang="php">
 
composer update --no-dev
 
composer update --no-dev
</source>
+
</syntaxhighlight>
  
 
<translate>
 
<translate>
 
<!--T:7-->
 
<!--T:7-->
This will update all Composer files to the latest versions as allowed in the <code>composer.json</code> file. If you feel that the versions located in the <code>composer.json</code> 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!
+
This will update all Composer files to the latest versions allowed in the ''composer.json'' file. If you feel that the versions located in the ''composer.json'' file are insufficient, 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!
 
</translate>
 
</translate>
  
 
<translate>
 
<translate>
== Are Composer files autoloading? == <!--T:8-->
+
== Are Composer Files Autoloading? == <!--T:8-->
 
All classes loaded via Composer are automatically autoloaded by the CMS.
 
All classes loaded via Composer are automatically autoloaded by the CMS.
 
</translate>
 
</translate>
  
 
<translate>
 
<translate>
== Can you install any extra libraries via Composer? == <!--T:9-->
+
== Can You Install Any Extra Libraries Via Composer? == <!--T:9-->
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 <code>composer.json</code> file within the main Joomla! download.
+
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.
 
</translate>
 
</translate>
  

Latest revision as of 17:47, 26 October 2022

Other languages:
English • ‎Nederlands • ‎español • ‎français • ‎português
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 the core and extensions. Composer is now a stable product widely used in the PHP community to update libraries that are registered and listed at Packagist, 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 at the their website.

Where are the Composer Files Located?[edit]

The Composer files are located in

JPATH_ROOT . '/libraries/vendor';

Can You Edit Files Loaded with Composer?[edit]

No You should never edit any files imported with Composer (including the Joomla! Framework packages). These are third-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?[edit]

Each are hosted in a separate repository. You can find them by going to the Joomla Framework website and searching for the appropriate package.

How Can I Update Libraries from Composer?[edit]

Get Composer from their Download page and run

composer update --no-dev

This will update all Composer files to the latest versions allowed in the composer.json file. If you feel that the versions located in the composer.json file are insufficient, 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?[edit]

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

Can You Install Any Extra Libraries Via Composer?[edit]

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.