It's a broad and opinion-based question. I think you basically need to figure out three things:
- Find and choose a Composer template to manage your dependencies. For example https://roots.io/bedrock/.
- WP-CLI commands. I see you are already at it.
- Find a way to export and import your WordPress config. For example https://wordpress.org/plugins/wp-cfm/
A basic setup routine then could maybe look like this:
# Download WordPress core and plugins.
composer install -n --no-dev
# Default DB name and user.
wp config create --dbname="test" --dbuser="root" --dbpass="" --dbhost="127.0.0.1"
# Install a basic site. The title doesn't matter.
wp core install --url="blog.localhost" --title="Lorem ipsum dolor sit amet" --admin_user="admin" --admin_password="admin" --admin_email="webmaster@example.com" --skip-email
# Language.
wp language core install de_DE
# Activate WP-CFM and import default conf.
wp plugin activate wp-cfm
wp config pull default
You don't necessarily need Composer. You can download WordPress and plugins with just WP-CLI as well. The advantage of Composer is the versioning, and that you only need a composer.json and -.lock file to keep your repo clean. It's then just one command composer install
that downloads you and your colleagues everything. Big advantage also is vendor/
can be cached during builds depending on the composer.lock checksum for example. This can shorten build time a lot.
Alternatively to the above sample routine you could also try to get an existing database backup imported and then just update the base URL and import the updated config. That would skip the WordPress install step and give you dummy content to maybe target automated tests at.