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. | + | 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 | + | == Where are the Composer Files Located? == <!--T:3--> |
The Composer files are located in | The Composer files are located in | ||
</translate> | </translate> | ||
− | < | + | <syntaxhighlight lang="php"> |
JPATH_ROOT . '/libraries/vendor'; | JPATH_ROOT . '/libraries/vendor'; | ||
− | </ | + | </syntaxhighlight> |
<translate> | <translate> | ||
− | == Can | + | == Can You Edit Files Loaded with Composer? == <!--T:4--> |
− | '''No | + | '''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 | + | == Where are the Joomla! Framework Files Located? == <!--T:5--> |
− | Each are hosted in a separate repository. | + | 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 | + | == How Can I Update Libraries from Composer? == <!--T:6--> |
− | + | Get Composer from [https://getcomposer.org/download/ their Download page] and run | |
</translate> | </translate> | ||
− | < | + | <syntaxhighlight lang="php"> |
composer update --no-dev | composer update --no-dev | ||
− | </ | + | </syntaxhighlight> |
<translate> | <translate> | ||
<!--T:7--> | <!--T:7--> | ||
− | This will update all Composer files to the latest versions | + | 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 | + | == 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 | + | == 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 | + | 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 23:47, 26 October 2022
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.