Composer Cheat Sheet for Developers
Composer Cheat Sheet for Developers
Installation Configuration
Command Description
Download Composer from [Link] and follow the instructions.
composer config sort-packages true Sort packages in [Link] alphabetically
Enable bash autocompletion:
© Nic Wortel, Software Consultant & Trainer - Last updated on August 3, 2023 - Find more cheat sheets at [Link]
Version constraints Repositories
Constraint Description Command Description
1.0.2 Exactly version 1.0.2 composer config [Link] Add a new repository named foo with the given URL
composer <url> as a Composer repository
>=1.0.2 Version 1.0.2 or higher
composer config [Link] vcs Add a new repository named foo with the given URL
>=1.0.2 <1.1.0 Version 1.0.2 or higher but lower than 1.1.0 <url> as a VCS repository
Version 1.0.2 or higher but lower than 1.1.0 or composer config [Link] vcs Add a new GitHub repository named foo/bar as a
>=1.0.2 <1.1.0 || >=1.2.0
version 1.2.0 or higher git@[Link]:foo/[Link] VCS repository
1.0 - 2.0 Version 1.0 to 2.0 (including 1.0 and 2.0) composer config [Link] path Add a new repository named foo with the given
1.0.* Version 1.0 with any patch version <path> path as a path repository
© Nic Wortel, Software Consultant & Trainer - Last updated on August 3, 2023 - Find more cheat sheets at [Link]