Curious about Composer but already have a WordPress site? Not to worry, I have you covered. Presenting Composerpress:
Composerpress is a plugin that analyses your WordPress install, and generates a composer.json
file you can then use retro-actively. This file acts as an inventory of dependencies, plugins, etc that are needed to set up a site, and you can use it to set up new sites quickly with the composer tool using:
composer install
It makes updating easier too, simply use:
composer update
Composer will then go and check all the dependencies and grab the latest valid versions. It’s great for automation! Simply take the output of composerpress and save it in your root directory in a composer.json
file.
Composerpress handles:
- WordPress.org packages via WPackagist
- Plugins in Git repositories
- Plugins in SVN repositories
- Plugins in Mercurial repositories
- Plugins using packagist
- John P Blochs WordPress Core package
Composerpress currently doesn’t handle themes.
Installation
Install the plugin by doing a git checkout/clone into your plugins folder, and activating, e.g.:
mkdir composerpress git clone https://github.com/Tarendai/composerpress.git . composer install
You could also download the repository as a zip file via Github, and do the final composer install
step to grab the dependencies.
If you need to update Composerpress do the following:
# update composerpress
git fetch origin
# update dependencies
composer update
Note: Composerpress requires PHP 5.3 or later, git will need to be available on the command line for git repository support, and PDO is needed for subversion repository support. If PDO is unavailable or PHP 5.3 is unavailable, the composer install
step will tell you. Mercurial/hg does not need to be installed for Mercurial repository support.
The resulting composer.json
will install WordPress to a WordPress subfolder, this can be changed by adding:
"extra": {
"wordpress-install-dir": "custom/path"
}
Click here for more information on the WordPress core composer installer. You can set the path to “.” for a non sub directory install, but this will prevent composer from updating the WP Core and may cause issues.
For more details on using Composer with WordPress, Rarst has a helpful microsite with examples here.
You may also find this WordPress install starter project by John P Bloch using composer useful.
RT @Tarendai: New Blogpost: ComposerPress http://t.co/ia1NpByRUL #wordpress #composer
@johnpbloch FYI http://t.co/YloEAp5t9f
RT @Tarendai: New Blogpost: ComposerPress http://t.co/ia1NpByRUL #wordpress #composer
RT @Tarendai: New Blogpost: ComposerPress http://t.co/ia1NpByRUL #wordpress #composer
RT @Tarendai: New Blogpost: ComposerPress http://t.co/ia1NpByRUL #wordpress #composer
Cool. “@Tarendai: New Blogpost: ComposerPress http://t.co/4XAHaMXtk9 #wordpress #composer”
RT @NaomiCBush: Cool. “@Tarendai: New Blogpost: ComposerPress http://t.co/4XAHaMXtk9 #wordpress #composer”
RT @Tarendai: New Blogpost: ComposerPress http://t.co/ia1NpByRUL #wordpress #composer
generate a composer.json file for an existing wordpress install: http://t.co/uBbBrE98wf
RT @retlehs: generate a composer.json file for an existing wordpress install: http://t.co/uBbBrE98wf
Sweet thing: @Tarendai published ComposerPress for #WordPress http://t.co/Qe0emMED2Y
RT @unserkaiser: Sweet thing: @Tarendai published ComposerPress for #WordPress http://t.co/Qe0emMED2Y
RT @unserkaiser: Sweet thing: @Tarendai published ComposerPress for #WordPress http://t.co/Qe0emMED2Y
@Rarst I’m lazy and haven’t taken the time to learn it. But I recognize its value. And tools like this (http://t.co/VdmovggORC) rock!
RT @EricMann: @Rarst I’m lazy and haven’t taken the time to learn it. But I recognize its value. And tools like this (http://t.co/VdmovggOR“¦
ComposerPress – Retroactively creates a composer.json for a WordPress site: http://t.co/AFMcKmAgxu
Was compiling a list of WP+Composer resources and came here for the link. Thought I’d suggest updating the part about themes, since wpackagist has added support for them. 🙂