Load WordPress core and plugins via Composer.
-
Setup your server so that
public
is the web root. -
Run
composer update
to install WordPress. -
Copy
vendor/wordpress/wordpress/wp-config-sample.php
toconfig/wp-config.php
. In this file, do a couple things:- Update database settings
- Define the following two constants, which will tell WordPress where to find plugins, themes, and uploads:
define('WP_CONTENT_DIR', dirname(__DIR__) . '/public/assets'); define('WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/assets');
-
Go to
yoursite/wp-admin/
and run through the WordPress install. -
Install some plugins using WordPress Packagist. Advanced Custom Fields, for example:
"require": {
"php": ">=5.2.4",
"wordpress/wordpress": "3.6"
"wpackagist/advanced-custom-fields": "4.2.*"
}
WordPress is loaded as a package by referencing its source on GitHub, while WordPress Packagist is loaded as a repository, which allows us to require plugins from it like we require packages from Packagist.
When either the update
or install
Composer commands are run, the wp-config-symlink
script is triggered, which creates a symlink from vendor/wordpress/wp-config.php
, where WordPress expects to find a config file, to config/wp-config.php
, where we manage our config file.
In addition to the symlink created by our Composer-hooked script, a few more symlinks exist in locations that WordPress expects to find its files. If you take a look in public
, you'll see three symlinks:
wp-admin -> ../vendor/wordpress/wordpress/wp-admin
wp-includes -> ../vendor/wordpress/wordpress/wp-includes
wp-login.php -> ../vendor/wordpress/wordpress/wp-login.php
This allows the WordPress admin to function from its home in vendor
.