Package Management System for PHP

Until recently, the only practical way to do package management for PHP was to use PEAR (PHP Extension and Application Repository). But PEAR’s long been regarded as difficult to work with and it’s crowded with outdated and unmaintained software. Many of the more popular PHP frameworks had their own private package-management systems — CakePHP’s Bakery, CodeIgniter’s Sparks — but little or nothing for PHP as a whole.

The biggest change to come along in this space is Composer, which takes notes from Node.js’s NPM system and Ruby’s Bundler. Packages are tracked on a project-by-project basis so that it’s easy to determine which packages are needed for a given project and can be installed automatically. It works with a repository named Packagist, which already includes many common PHP apps, frameworks, and components.

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you. Composer is not a package manager. Yes, it deals with “packages” or libraries, but it manages them on a per-project basis, installing them in a directory inside your project. By default it will never install anything globally. Thus, it is a dependency manager.

Packagist is the main Composer repository. It aggregates all sorts of PHP packages that are installable with Composer.