WordPress dependency management with Composer
With Composer, you can define the WordPress core as a dependency so you never have to include it in your repo.
You can also specify which plugins and themes you want to require.
For this to work, the WordPress core needs to be put in its own directory.
The included composer.json file is already set up to do all of this for you.
If the plugins/themes you want are published to the wordpress.org SVN repo, they will also be available on WordPress Packagist, which is a Composer repository that mirrors the SVN repo.
If you want to install a plugin from your version control system (Git, SVN, etc.), please follow these instructions.
The included composer.json file has an example of getting a plugin from Github.
Install Composer before you do anything else.
composer create-project -s dev --prefer-dist --no-interaction -- webdeveric/wp-starter ./your-folder-here
Run composer setup-hooks
to setup the git pre-commit
hook. It will check coding standards and run tests when you commit.
I’ve included a Dockerfile that is based on php:8.3-apache
It comes with Xdebug
already installed.
A sample DB will be imported the first time you build. The WordPress username and password are both wp
.
To get started, run the following:
1️⃣ make install
2️⃣ make dev
You may want to view the Makefile to see all the commands.