spinwplocal is a set of scripts that create and destroy local WordPress sites using Laravel Valet and the WP-CLI Valet driver.
It automates local WordPress site setup with sensible defaults for fast and simple WP local dev env provisioning.
Note: This tool is designed for macOS, leveraging Laravel Valet which is officially supported on macOS. Linux and Windows users may need to explore alternative local development solutions.
Before installing, ensure the following are installed and configured:
Note: To avoid PHP deprecation warnings with
wp-cli-valet-command(see Issue #94), thePHP_BINvariable in the.env.example(copied to.envduring install) is set by default to use PHP 8.0 (installed via Valet using Homebrew to/opt/homebrew/opt/php@8.0/bin/php).
Using Laravel Valet the PHP deprecated warnings can be resolved by using Valet to download and build PHP 8.0:
valet park
valet use php@8.0Fork this repo on GitHub, then clone your fork locally:
git clone https://github.com/yourusername/spinwplocal.git
cd spinwplocalThe install script was created for convenience and uses default variables that you can adjust if need be:
BIN_DIR="${HOME}/.local/bin"— directory where executables will be symlinked; must be in your PATHENV_FILE=".env"— environment configuration fileENV_EXAMPLE_FILE=".env.example"— example env file templateSCRIPTS="wplocalup wplocaldown"— scripts to install
Set execute permissions on the install script:
chmod +x installRun the installer script to set up the environment:
./install- This copies
.env.exampleto.envif it does not exist. - creates the binary directory if it does not exist (note: the binary directory must be in your
PATH) - and symlinks the scripts into the
BIN_DIR.
Edit the .env file to set your database credentials, PHP binary path, and other environment-
specific settings. This file is loaded by the wplocalup and wplocaldown scripts at runtime.
Use the installed commands to create or destroy WordPress sites:
wplocalup <sitename>— create a new local WordPress sitewplocaldown <sitename>— destroy an existing local WordPress site
This project was inspired by:
- The SpinupWP blog post by Jonathan Wold
- The YouTube tutorial by OxyProps
This is a personal project and does not include a license. Use freely but at your own risk.
