I’d personally suggest Lando with it’s WordPress recipe that is quite straight forward and relatively easy to set up on Ubuntu or Mac. Not sure about Windows. Quick Lando WP recipe conf overview:
Features of this plugin:
- Configurable
php
version from 5.3
all the way to 8.1
- Configurable
webroot
- Configurable web server (
apache
or nginx
)
- Configurable database backend (
mariadb
, mysql
, or postgres
)
- Configurable
composer
wp cli
xdebug
All main services and their versions easily configurable.
My typical directory setup:
# directory structure of project_root
.
├── .lando/ # directory for Lando configuration files
│ ├── php.ini
│ └── ...
├── .vscode/ # directory for VS Code specific configuration
│ └── launch.json # for xdebug configuration
├── site/ # directory for roots/bedrock
│ ├── .env
│ └── ...
├── trellis/ # directory for roots/trellis
│ └── ...
├── .lando.yml
└── .gitignore
Lando configuration file:
# project_root/.lando.yml
name: example
recipe: wordpress
env_file:
- site/.env
config:
php: "8.0"
composer_version: "2-latest"
via: nginx
webroot: site/web
database: mariadb
xdebug: true
config:
php: .lando/php.ini
proxy:
phpmyadmin:
- pma.example.lndo.site
mailhog:
- mail.example.lndo.site
services:
phpmyadmin:
type: phpmyadmin
hosts:
- database
mailhog:
type: mailhog
hogfrom:
- appserver
dev:
type: node:16
overrides:
ports:
- 3000:3000 # for bud dev
tooling:
yarn:
service: dev
Env setup:
# project_root/site/.env
DB_NAME='wordpress' # default for Lando
DB_USER='wordpress' # default for Lando
DB_PASSWORD='wordpress' # default for Lando
DB_HOST='database' # default for Lando
WP_ENV='development'
WP_HOME='http://example.lndo.site'
WP_SITEURL="${WP_HOME}/wp"
VS Code launch conf for Xdebug:
# project_root/.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug (9003)",
"type": "php",
"request": "launch",
"port": 9003,
"log": false,
"pathMappings": {
"/app/site/": "${workspaceFolder}/site/"
}
}
],
"sourceFileMap": {
"/app/site/": "${workspaceFolder}/site/"
}
}
PHP ini conf for Lando and Xdebug:
; Xdebug
xdebug.max_nesting_level = 512
xdebug.show_exception_trace = 0
xdebug.collect_params = 0
; Extra custom Xdebug setting for debug to work in VSCode.
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_host = ${LANDO_HOST_IP}
xdebug.remote_connect_back = 1
xdebug.remote_log = /tmp/xdebug.log
; Test
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_host = ${LANDO_HOST_IP}
xdebug.log = /tmp/xdebug.log
With all this set up, just lando start
from project root where .lando.yml is, then lando composer install
from site dir, lando composer install
+ lando yarn
+ lando yarn build
from sage (^v10.x) directory.
To make bud dev work you should make changes to your theme’s bud.config.js file accordingly:
/**
* Proxy origin (`WP_HOME`)
*/
.proxy("http://example.lndo.site")
/**
* Development origin
*/
.serve("http://example.lndo.site:3000")
Then lando yarn dev
That’s pretty much it.