WordPress Composer - markhowellsmead/helpers GitHub Wiki
WordPress core is not currently equipped for management with Composer. However, if you are prepared to forego the benefits of using either the onboard automatic update process or WP CLI, you can use Composer. This page assumes that you are familiar with the concepts and principles of Composer.
Example Composer file
Note that by using this method, you'll need to amend the standard WordPress configuration file wp-config.php
to tell WordPress to use the subfolder wp
in the webroot, instead of looking for the WordPress installation in the web root folder.
The web root in this instance is web/
inside the folder in which the composer.json
file is located. The project folder (repository) will then contain the Composer files and two subfolders: vendor
(which manages Composer tools) and web
(your webroot). This ties in with the settings indicated on my Vagrant page.
{
"repositories": [{
"type": "composer",
"url": "https://wpackagist.org"
}],
"require": {
"johnpbloch/wordpress": "^4.7",
"wpackagist-plugin/advanced-custom-fields": "4.4.10",
"wpackagist-plugin/google-analytics-for-wordpress": "5.5.2",
"wpackagist-plugin/search-filter": "1.2.9",
"wpackagist-plugin/wp-migrate-db": "0.8"
},
"extra": {
"wordpress-install-dir": "web/wp",
"installer-paths": {
"web/wp-content/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
"web/wp-content/plugins/{$name}/": ["type:wordpress-plugin"],
"web/wp-content/themes/{$name}/": ["type:wordpress-theme"]
}
}
}