With the introduction of Drupal 8 the Composer package manager became the goût du jour for me. And once you start using Composer to manage your PHP-projects you never want to do it any other way.

So how do you go about it if you want to spin up a WordPress site using composer? There is plenty of useful information to be found on the internets, not least from the competent people at roots.io. This piece was written all the way back in August of 2013, but still seems to be the best summary out there:

Using WordPress with Composer

After reading this and following the instructions I still found it hard to get the plugins and themes in the right directory. So here is my current boilerplate composer.json for spinning up a WordPress site, hopefully it helps someone else looking for the same thing:

    "require": {
        "johnpbloch/wordpress": "^4.9",
        "wpackagist-plugin/fakerpress": "^0.4.11"
    "extra": {
        "wordpress-install-dir": "wp",
        "installer-paths": {
            "wp/wp-content/plugins/{$name}/": ["type:wordpress-plugin"],
            "wp/wp-content/themes/{$name}/": ["type:wordpress-theme"]
    "repositories": [

I'm sure this can be done even better and I look forward to any suggestions in the comment section below this article.

So once you've installed WordPress itself and you want to add a plugin, you do that by typing

composer require wpackagist-plugin/{name of plugin}

In the boilerplate above I've included the Fakerpress plugin, which allows you to quickly add place holder content in your WP site. Not dissimilar to the devel generate functionality in the Drupal Devel module.