Install WordPress with composer

This website was deployed using a hand full of files and composer.

These files were pushed to the Buddy VCS and using its pipeline features those few files were uploaded to this server via SFTP.

Buddy then connected using SSH and executed the command:

compser install

This installed WordPress thanks a package from: John P. Bloch

johnpbloch/wordpress

Composer also installs some themes and plugins, this is a copy of my composer.json file at the time of writing this short post.

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    }
  ],
  "require": {
    "php": ">=5.4",
    "composer/installers": "1.*",
    "johnpbloch/wordpress": "^4.8",
    "wpackagist-plugin/akismet":"dev-trunk",
    "wpackagist-plugin/captcha":">=3.9",
    "wpackagist-theme/twentyseventeen":"^1.3"
  },
  "extra": {
    "wordpress-install-dir": "wp",
    "installer-paths": {
      "content/mu-plugins/{$name}/": [
        "type:wordpress-muplugin"
      ],
      "content/plugins/{$name}/": [
        "type:wordpress-plugin"
      ],
      "content/themes/{$name}/": [
        "type:wordpress-theme"
      ]
    }
  }
}

This also defines the WordPress install folder as wp and the wp-content folder as content for my theme and plugins installed using wpackagist.

If you don’t include a theme such as twenty seventeen as I have here then your install will load blank.

If you are interested in doing this you will require a few files like an index.php to call wordpress and a wp-config.php for the config as well as defining an env-config.php file for the database connection.

You can find these in a repo I have created on github to show the files needed.

This was just a quick post for the first post on my blog for some content I will go more in depth with detail in future posts.

 

Leave a Reply

Your email address will not be published. Required fields are marked *