Nasrul Hazim Bin Mohamad

WordPress: Install from Composer


Create a composer.json in project root directory and copy paste the following composer configuration. Then run composer install.

    "name": "blog/your-name",
    "description": "my Official blog",
    "repositories": [
      "type": "composer",
      "url": ""
    "require": {
        "php": ">=5.4",
        "johnpbloch/wordpress": "4.2"
    "extra": {
        "wordpress-install-dir": "wp"

Once done, copy wp/index.php to project root directory and update require( dirname( __FILE__ ) . '/wp-blog-header.php' ); to require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );.

Now run the WP at http://localhost/wp-project-root and continue with installation and you’re done.


  1. Using Composer With WordPress
  2. Composer in WordPress
  3. Giving WordPress It’s Own Directory

Leave a Reply

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

nineteen − eleven =