This site was asked for too many times to not happen. Think of it as unofficial companion to Composer documentation for WordPress developers.
Composer is dependency manager command line utility and accompanying infrastructure tools. It is made in PHP and for PHP.
It can help you improve how you develop, share, make use of, host, and deploy your WordPress code and whole site stacks.
So what is “dependency”? Basic building block of Composer world is “package” and it is:
So pretty much anything can be package. Packages preferably contain information that Composer can read and process. That information can include which other packages at which versions are required as dependencies.
In WordPress world Composer package can be:
It also opens up a way to depend on (and share) generic PHP libraries, without embedding their sources.
There is also special kind of platform package dependency. It allows to depend on specific PHP version and extensions.
Packages are not of much use somewhere out there. That is why from a starting point (“root” package) Composer will:
Composer thrives on compatibility and packages can come from:
This site will provide you with information on how to:
Theory is no replacement for experience and there are already practical examples of using Composer with WordPress code (old and new) available.