Jump to content

Composer (software): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Mkraghn (talk | contribs)
mNo edit summary
Supported frameworks - spelling Silverstripe changed
 
(39 intermediate revisions by 32 users not shown)
Line 1: Line 1:
{{short description|Software; application level dependency manager for the PHP programming language}}
{{Infobox software
{{Infobox software
| name = Composer
| name = Composer
| logo = Logo-composer-transparent.png
| logo = Logo-composer-transparent.png
| logo size = 120px
| logo size = 120px
| screenshot =
| screenshot =
| caption =
| caption =
| author =
| author =
| developer = Nils Adermann,<br />Jordi Boggiano
| developer = Nils Adermann,<br />Jordi Boggiano
| released = {{release date and age|2012|03|01}}<ref name='ird' />
| released = {{release date and age|2012|03|01}}<ref name='ird' />
| latest release version = 1.8.4
| latest release version = {{wikidata|property|preferred|references|edit|P348|P548=Q2804309}}
| latest release date = {{release date and age|2019|02|11}}<ref>[https://getcomposer.org/download/ Composer download list]</ref>
| latest release date = {{Start date and age|{{wikidata|qualifier|preferred|single|P348|P548=Q2804309|P577}}|df=yes}}
| latest preview version =
| latest preview version =
| latest preview date =
| latest preview date =
| programming language = [[PHP]]
| programming language = [[PHP]]
| operating system = [[Cross-platform]]
| operating system = [[Cross-platform]]
| platform =
| platform =
| language =
| language =
| genre = [[Package manager]]
| genre = [[Package manager]]
| license = [[MIT License]]
| license = [[MIT License]]
| website = {{URL|http://getcomposer.org/}}
| website = {{URL|https://getcomposer.org/}}
}}
}}


'''Composer''' is an [[application-level package manager]] for the [[PHP]] [[programming language]] that provides a standard format for managing dependencies of PHP software and required [[Library (computing)|libraries]]. It was developed by Nils Adermann and Jordi Boggiano, who continue to manage the project. They began development in April 2011 and first released it on March 1, 2012.<ref name='ird'>[https://github.com/composer/composer/releases/tag/1.0.0-alpha1 Software release], github.com, Retrieved April 24, 2016.</ref> Composer is strongly inspired by [[Node.js|Node.js's]] "[[Npm (software)|npm]]" and [[Ruby (programming language)|Ruby's]] "[[Bundler (software)|bundler]]".<ref>[https://getcomposer.org/doc/00-intro.md#dependency-management Getting Started/Dependency management], getcomposer.org, Retrieved November 28, 2013.</ref> The project's dependency solving algorithm started out as a PHP-based port of openSUSE's [[ZYpp|libzypp]] satsolver.<ref>[https://github.com/composer/composer#acknowledgments Composer acknowledgements]</ref>
'''Composer''' is an [[application-level package manager|application-level dependency manager]] for the [[PHP]] [[programming language]] that provides a standard format for managing dependencies of PHP software and required [[Library (computing)|libraries]]. It was developed by Nils Adermann and Jordi Boggiano, who continue to manage the project. They began development in April 2011 and first released it on March 1, 2012.<ref name='ird'>[https://github.com/composer/composer/releases/tag/1.0.0-alpha1 Software release], github.com, Retrieved April 24, 2016.</ref> Composer is strongly inspired by [[Node.js|Node.js's]] "[[npm]]" and [[Ruby (programming language)|Ruby's]] "[[Bundler (software)|bundler]]".<ref>[https://getcomposer.org/doc/00-intro.md#dependency-management Getting Started/Dependency management], getcomposer.org, Retrieved November 28, 2013.</ref> The project's dependency solving algorithm started out as a PHP-based port of openSUSE's [[ZYpp|libzypp]] [[SAT solver]].<ref>{{Cite web|url=https://github.com/composer/composer|title=composer/composer|date=Jun 23, 2020|accessdate=Jun 24, 2020|via=GitHub}}</ref>


Composer runs from the [[command line]] and installs dependencies (e.g. libraries) for an application. It also allows users to install PHP applications that are available on "Packagist"<ref>See [https://packagist.org/ packagist.org]</ref> which is its main repository containing available packages. It also provides [[autoload]] capabilities for libraries that specify autoload information to ease usage of third-party code.
Composer runs from the [[command line]] and installs dependencies (e.g. libraries) for an application. It also allows users to install PHP applications that are available on "Packagist"<ref>See [https://packagist.org/ packagist.org]</ref> which is its main repository containing available packages. It also provides [[autoload]] capabilities for libraries that specify autoload information to ease usage of third-party code.
Line 28: Line 29:
=== Commands ===
=== Commands ===
Composer offers several parameters including :<ref>{{cite web|url=https://getcomposer.org/doc/03-cli.md|title=Command-line interface / Commands |website=getcomposer.org}}</ref>
Composer offers several parameters including :<ref>{{cite web|url=https://getcomposer.org/doc/03-cli.md|title=Command-line interface / Commands |website=getcomposer.org}}</ref>
* <code>require</code>: add the library in parameter to the file [[JavaScript_Object_Notation|composer.json]], and install it.
* <code>require</code>: add the library in parameter to the file composer.json, and install it.
* <code>install</code>: install all libraries from composer.json. It's the command to use to download all PHP repository dependencies.
* <code>install</code>: install all libraries from composer.json. It's the command to use to download all PHP repository dependencies.
* <code>update</code>: update all libraries from composer.json, according to the allowed versions mentioned into it.
* <code>update</code>: update all libraries from composer.json, according to the allowed versions mentioned into it.
Line 37: Line 38:
composer require monolog/monolog
composer require monolog/monolog


<source lang="javascript">
<syntaxhighlight lang="javascript">
{
{
"require": {
"require": {
Line 43: Line 44:
}
}
}
}
</syntaxhighlight>
</source>


=== Versions ===
=== Versions ===
Line 53: Line 54:
| >= || allows to extend the number. Moreover, we can use: >, <, <=. || <code>"php": ">=5.5.9"</code> includes PHP 7.
| >= || allows to extend the number. Moreover, we can use: >, <, <=. || <code>"php": ">=5.5.9"</code> includes PHP 7.
|-
|-
| != || excludes a version. ||
|!= || excludes a version. ||
|-
|-
| - || defines a range of versions. ||
| - || defines a range of versions. ||
|-
| &brvbar;&brvbar; || add possibles versions. || <code>"symfony/symfony": "2.8 &brvbar;&brvbar; 3.0"</code> regroups only these two versions.
|-
|-
| * || extends to all subversions. || <code>"symfony/symfony": "3.1.*"</code> includes the 3.1.1.
| * || extends to all subversions. || <code>"symfony/symfony": "3.1.*"</code> includes the 3.1.1.
Line 66: Line 65:
|}
|}


== Supported framework ==
== Supported frameworks ==


* [[Symfony]] version 2 and later
* [[Symfony]] version 2 and later
Line 75: Line 74:
* [[Drupal]] version 8 and later
* [[Drupal]] version 8 and later
* [[TYPO3]] version 6.2 and later
* [[TYPO3]] version 6.2 and later
* [[SilverStripe]] version 3.0 later
* [[Neos Flow]] version 2.0 and later
* [[Silverstripe]] version 3.0 later
* [[Magento]] version 2.0 later
* [[Magento]] version 2.0 later
* [[OpenMage]] version 20.0.0 and later
* [[Yii]] version 1.1 and later
* [[Yii]] version 1.1 and later
* [[Laminas]]
* [[Zend Framework]] version 1 and later
* [[Silex (web framework)]]
* Silex (web framework)
* [[Lumen (web framework)]]
* [[Lumen (web framework)]]
*Adianti Framework version 1 and later


== See also ==
== See also ==
Line 96: Line 98:
* [https://getcomposer.org/doc/ Composer documentation]
* [https://getcomposer.org/doc/ Composer documentation]
* [https://www.codementor.io/php/tutorial/composer-install-php-dependency-manager Composer Tutorial]
* [https://www.codementor.io/php/tutorial/composer-install-php-dependency-manager Composer Tutorial]
*[https://www.onlineinterviewquestions.com/creating-installer-laravel-project/ Automate basic composer tasks in Laravel]
* [https://packagist.org/ Packagist - the main Composer repository]
* [https://packagist.org/ Packagist - the main Composer repository]
* {{Openhub|composer|Composer}}
* {{Openhub|composer|Composer}}


{{PHP|state=collapsed}}
{{PHP|state=collapsed}}
{{Package management systems}}


[[Category:Free package management systems]]
[[Category:Free package management systems]]
[[Category:Free software programmed in PHP]]
[[Category:Free software programmed in PHP]]
[[Category:PHP software]]
[[Category:Software using the MIT license]]

Latest revision as of 15:54, 18 December 2024

Composer
Developer(s)Nils Adermann,
Jordi Boggiano
Initial releaseMarch 1, 2012; 12 years ago (2012-03-01)[1]
Stable release
2.8.4[2] Edit this on Wikidata / 11 December 2024; 11 days ago (11 December 2024)
Repository
Written inPHP
Operating systemCross-platform
TypePackage manager
LicenseMIT License
Websitegetcomposer.org

Composer is an application-level dependency manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries. It was developed by Nils Adermann and Jordi Boggiano, who continue to manage the project. They began development in April 2011 and first released it on March 1, 2012.[1] Composer is strongly inspired by Node.js's "npm" and Ruby's "bundler".[3] The project's dependency solving algorithm started out as a PHP-based port of openSUSE's libzypp SAT solver.[4]

Composer runs from the command line and installs dependencies (e.g. libraries) for an application. It also allows users to install PHP applications that are available on "Packagist"[5] which is its main repository containing available packages. It also provides autoload capabilities for libraries that specify autoload information to ease usage of third-party code.

Syntax

[edit]

Commands

[edit]

Composer offers several parameters including :[6]

  • require: add the library in parameter to the file composer.json, and install it.
  • install: install all libraries from composer.json. It's the command to use to download all PHP repository dependencies.
  • update: update all libraries from composer.json, according to the allowed versions mentioned into it.
  • remove: uninstall a library and remove it from composer.json.

Libraries definition

[edit]

Example of composer.json generated by the following command:

composer require monolog/monolog
{
    "require": {
        "monolog/monolog": "1.2.*"
    }
}

Versions

[edit]

The different authorized versions of the libraries are defined by:[7]

Symbol Role (placed before a version number) Example
>= allows to extend the number. Moreover, we can use: >, <, <=. "php": ">=5.5.9" includes PHP 7.
!= excludes a version.
- defines a range of versions.
* extends to all subversions. "symfony/symfony": "3.1.*" includes the 3.1.1.
~ extends to the next versions of the same level. "doctrine/orm": "~2.5" also concerns the 2.6, but neither the 2.4 nor the 3.0.
^ same as tilde, only if there is a backward compatibility.

Supported frameworks

[edit]

See also

[edit]

References

[edit]
  1. ^ a b Software release, github.com, Retrieved April 24, 2016.
  2. ^ "Release 2.8.4". 11 December 2024. Retrieved 22 December 2024.
  3. ^ Getting Started/Dependency management, getcomposer.org, Retrieved November 28, 2013.
  4. ^ "composer/composer". Jun 23, 2020. Retrieved Jun 24, 2020 – via GitHub.
  5. ^ See packagist.org
  6. ^ "Command-line interface / Commands". getcomposer.org.
  7. ^ "Versions and constraints - Composer". getcomposer.org.
[edit]