This is designed as a quick boilerplate for working in WordPress on Laravel Valet. It is primarily built to facilitate my own workflow and provides the following:
- Array-based configuration from a single file
- WordPress in a sub-directory
- Remote image loading where a local version of the file isn't found
- WP debug log moved outside of the wp-content directory
- A development log and utility for dumping data to a separate log file while working
- A set of WP-CLI commands under
wp valetbp
for easy synchronisation with remote sites
Please note: this is a fairly opinionated set up and that really comes down to the fact that this was designed to aid my own existing workflow. Feel free to fork and mod to suit your own needs.
- Make sure you have installed all dependencies (see dependencies section further down)
- In your terminal, head to your Valet directory:
cd ~/path/to/valet
- Clone this puppy into a new project under your valet directory:
git clone https://github.com/mishterk/wp-valet-boilerplate my-new-project
- Move into the project directory:
cd my-new-project
- Create a local config file:
cp valetbp-config-sample.php valetbp-config.php
- Modify the config file accordingly.
- Run the installation:
php bin/install.php
Aside from the above-mentioned dependencies, this boilerplate is also geared towards the following:
- MailHog via Homebrew
- WP Migrate DB Pro WordPress plugin
- WP Migrate DB Pro WordPress plugin CLI Addon
- Advanced Custom Fields Pro WordPress plugin
Hate long waits for Composer? Check out the Prestissimo package for parallel package installation.
Carries out a full sync and local config based on settings in valetbp-config.php under sync. This includes:
- Pulling the DB via WP Migrate DB Pro
- Registering ACF Pro serial key
- Installing any dev-only plugins
- De/Activating plugins to suit the development environment
- Flushing rewrite rules
- Logging in
Carries out all post database sync tasks listed in the sync
command
Generates a one-time login URL and opens that URL in the browser. The authenticated user will be that configured in valetbp-config.php under auth.username.
Pulls the DB via WP Migrate DB Pro with CLI Addon
Registers the ACF Pro key
Installs any plugins configured in valetbp-config.php under sync.plugins.activate
De/activates any plugins as per the valetbp-config.php under sync.plugins
Fires a test email via wp_mail()
and opens up Mailhog in a browser for review