Automate PHP Dependencies Management with Composer Turbocharged with Buddy
This guide will explain you how to deal with PHP libraries and their dependencies using Composer and how to combine this tool with Buddy’s features to set up a continuous delivery pipeline for your PHP-based projects.
Objectives of This Guide
This guide will:
- Explain you the core features of Composer.
- Outline the development process with Composer and indicate possible benefits.
- Describe the delivery automation with Buddy and Composer.
Why Composer?
PHP applications are getting more and more complex. To complete projects in reasonable time, you often need to rely on third-party libraries.
But it comes at a price:
- The external libraries you’re using are added to the project repository and pump up its volume, which causes maintenance problems.
- Updating the libraries is extremely time-consuming, as it requires downloading up-to-date versions to the repository and committing all the files.
- You need to set up an autoloader for each library manually.
Composer solves all the above problems with one configuration file, storing the list of libraries and their versions. Upon issuing the composer install
command all the libraries are downloaded in adequate versions and Composer automatically creates an autoloader that links them.
Thanks to this:
- You keep only one configuration file in the repository, instead of all the libraries.
- Updating libraries to its new version requires a change in the configuration file and calling a method composer install.
- Every new library added to the configuration file is ready to use after executing the composer install command.