ValetPress allows for the quick installation and configuration of WordPress install for local development and testing. The idea of this script was inspired by the script that @AaronRutley originally created (https://github.com/AaronRutley/valetpress) but has been written from the ground up to provide cleaner code, as well as adding/removing features that I felt were or were not necessary for my daily usage.
The script itself uses Laravel Valet and WP-CLI to speed up the creation of a WordPress install on your local system. Before @AaronRutley demoed his script to me I was using MAMP, and/or manually setting up installs on my computer which was far more time-consuming than his script was.
While the original script works great… I got bored and decided to rewrite it for my own needs.
- Create a fresh WordPress site in a few seconds
- Download, Install and activate WordPress
- Auto-login to the new WordPress install
- Easily delete the WordPress install(s)
- Setup Laravel Valet / MySQL Instructions
- Download / Clone this repo into a directory such as
~/Scripts/valetpress
- Include the
vp
script in your.bash_profile
or.zshrc
file - A Brewfile is included to help with the dependencies that are needed.
brew bundle
- Update the
config.json
file to reflect your needed settings. (see the 'Config Explained' section below)
vp create or vp -c
- Download WordPress into a directory like
~/Sites/myproject
as specified in the config.json - Setup the database called
myproject
& configure the install - Create a user
admin
with the passwordpassword
- Have
myproject.test
running in just a few seconds
vp delete or vp -d
- Lists all ValetPress installations
- Will ask for the name of the project you would like to delete
- Ask you to confirm that you wish to delete the project
- Deletes the database for that project
- Deletes the directory for that project
vp help of vp -h
- Will display a summary of available commands
wp_admin_email
is used as the admin email address for new WP installs.wp_admin_user
is used as the username for new WP installs. If changed you must update the username in the ValetPress pluginwp_admin_password
is used as the password for new WP installs. If changed you must update the password in the ValetPress pluginsites_folder
is a directory that you've runvalet park
in to serve sites.open_browser
if set to1
a browser will auto-open after the install completes,0
will make so that it doesn'tbrowser
you can set the default browser such as Safari, Google Chrome, etcvalet_domain
Default is set totest
but you can change this to whatever you use for Valet, this can be adjusted by usingvalet domain TLDTOUSE
plugins_add
Plugins that you wish to install/activate on each new installplugins_remove
Plugins that you wish to remove from the default installsauto_update
Enabled auto-updates to core, plugin and theme. 0 = Disabled, 1 = Enabledphp
Specify the location of PHPvalet
Specify the location of Laravel Valetwpcli
Specify the location of WP-CLI
Below you will find a list of all required system files in order for ValetPress to properly work.
- Valet - With out this sites will not load
- MySQL or MariaDB - Needed for WordPress
- Homebrew - Used for installing MySQL/PHP/etc
- jq - Used for reading the config file
- WP-CLI - Needed to complete WordPress installs.
Note: You will need to add the ValetPress directory to your $PATH in your .bash_profile
or .zshrc
so that you can run the vp
command from anywhere on your computer.