Composer is the dependency manager for PHP that allows you to add and manage script libraries and packages as dependencies in your project, in order to reduce development time and have the ability to take advantage of third-party code.
- [Instructor] Let's start at the very top by answering the question what is Composer? According to the Composer website, Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage, so install and update, those libraries for you. That's a pretty descriptive, if succinct, explanation. At the practical level, Composer allows you to install, update, and manage the libraries, also known as packages, you want to use in your PHP projects on a project by project basis.
The project becomes dependent on these packages, thus, the description of Composer as a dependency management tool. You use Composer to declare what packages and package versions your project depends on, and Composer, in turn, will manage these packages for you. This is an automated alternative to finding the package or library you want to use on GitHub or another source and then copying those files into your project manually and monitoring the code for future updates and manual upgrades yourself.
When you migrate your project or share it with other developers, these same dependencies can be brought in automatically, modified, added to, or removed before sending them back to you, all thanks to Composer. So, if you plan on using packages or libraries in your PHP project, Composer makes that job easier.
- Running PHP
- Installing Composer
- Finding packages
- Using packages in your code
- Using Composer with version control
- Updating packages