Core Package recipe

Composer works best with code accompanied by composer.json and that is something WordPress core hadn’t adopted yet. There is a bit of tinkering involved to create shim package for core.

Create Custom Package

Package description follows same rules as composer.json file, with addition of version and where to download distribution and/or source from.

With Composer-aware projects these are usually automagically inferred from combination of composer.json and version control. Tags and branches serve as versions, version control itself and APIs for archives (for GitHub and Bitbucket) as downloads.

For Composer-unaware project the mechanics are much the same, but the downside is that we need to define package for every version individually.

Release Package

Package for a specific release version of WordPress can be defined like this:

for name I am declaring it in my own rarst/* vendor namespace, so it doesn’t conflict with anything

wordpress-core type and johnpbloch/wordpress-core-installer dependency serve to allow clean path customization (otherwise Composer will try to nest core in a vendor directory), see site stack recipe for details

distribution points to simple direct download from official site

source points to the release tag at official GitHub mirror, although original Subversion repository would work as well

Require Package in Project

Now that you have package definition you can drop it into right into composer.json of site package, repositories : [] field. Easy, but gets bulky fast for multiple versions.