Composer is a package manager for PHP. The WordPress Packagist site mirrors the WordPress plugin directory as a Composer-compatible repository, making it easier to manage WordPress plugins using Composer.
Composer has been making waves in the PHP open source world because it makes it easier for developers to share and reuse code. Developers can declare dependencies in a JSON file then run Composer on the command line to download all the necessary files.
Here at Outlandish Ideas we’re big fans of WordPress as an easy to use and extensible CMS. We’ve recently started using Composer to manage our more complex web projects. And now we’re creating the tools to use both together.
Composer natively supports WordPress plugins using installers however most WordPress plugins do not include a composer.json file which means they cannot be referenced directly. The WordPress Packagist site addresses this problem by scanning the WordPress plugin Subversion repository and generating the necessary JSON files for each plugin. Using it is a matter of adding a couple of lines to your composer.json then referencing plugins as you would any other dependency.
We’ve been very pleased to see the positive reaction this project has received from both the Composer and WordPress communities. It’s still early days so if you experience any problems or have suggestions for improvement, please create an issue on GitHub. Or even better, dive in to the code and fix it yourself!
(Image by Nikolay Bachiyski, published under Creative Commons licence)