-
GitHub stars
-
Projects created
-
roots/wordpress installs
Bedrock with Valet
Laravel Valet is a local development environment. In this guide you will learn how to setup a Bedrock-based WordPress site with Valet.
Valet supports Bedrock out of the box, along with traditional WordPress installations, Laravel apps, Drupal sites, and more. Since Valet is very lightweight, it is a great local development setup for folks that are working on several WordPress sites at any given time.
See the Valet installation docs for information on how to install Valet. You will also want to install the Valet WP-CLI command:
$ wp package install aaemnnosttv/wp-cli-valet-command:@stable
# Setting up a Bedrock site
To create a new Bedrock site for Valet, navigate to Valet sites directory and use the wp valet
command:
$ cd ~/Sites/valet
$ wp valet new bedrock --project=bedrock
You should now be able to access your new site at https://bedrock.test
.
If you hit a 404, make sure that you have ran valet park
from your Valet sites directory first.
# Bedrock multisite
# Subdomain installs
-
wp valet new bedrock-multisite --project=bedrock
- Add to
config/application.php
in Bedrock:
Config::define('WP_ALLOW_MULTISITE', true);
- Visit
https://bedrock-multisite.test/wp/wp-admin/network.php
to install the network and select subdomain install - Add to
.env
:DOMAIN_CURRENT_SITE=bedrock-multisite.test
- Update
config/application.php
again with full multisite constants:
/**
* Multisite
*/
Config::define('WP_ALLOW_MULTISITE', true);
Config::define('MULTISITE', true);
Config::define('SUBDOMAIN_INSTALL', true);
Config::define('DOMAIN_CURRENT_SITE', env('DOMAIN_CURRENT_SITE'));
Config::define('PATH_CURRENT_SITE', env('PATH_CURRENT_SITE') ?: '/');
Config::define('SITE_ID_CURRENT_SITE', env('SITE_ID_CURRENT_SITE') ?: 1);
Config::define('BLOG_ID_CURRENT_SITE', env('BLOG_ID_CURRENT_SITE') ?: 1);
- Add the Bedrock multisite URL fixer plugin:
composer require roots/multisite-url-fixer
- Link any subdomains to current site with Valet:
$ valet link test.bedrock-multisite
$ valet link site2.bedrock-multisite
# Subfolder / subdirectory installs
- Copy the Bedrock multisite subdirectory driver into
~/.valet/Drivers/
-
wp valet new bedrock-multisite --project=bedrock
- Add to
config/application.php
in Bedrock:
Config::define('WP_ALLOW_MULTISITE', true);
- Visit
https://bedrock-multisite.test/wp/wp-admin/network.php
to install the network and select subfolder install - Add to
.env
:DOMAIN_CURRENT_SITE=bedrock-multisite.test
- Update
config/application.php
again with full multisite constants:
/**
* Multisite
*/
Config::define('WP_ALLOW_MULTISITE', true);
Config::define('MULTISITE', true);
Config::define('SUBDOMAIN_INSTALL', false);
Config::define('DOMAIN_CURRENT_SITE', env('DOMAIN_CURRENT_SITE'));
Config::define('PATH_CURRENT_SITE', env('PATH_CURRENT_SITE') ?: '/');
Config::define('SITE_ID_CURRENT_SITE', env('SITE_ID_CURRENT_SITE') ?: 1);
Config::define('BLOG_ID_CURRENT_SITE', env('BLOG_ID_CURRENT_SITE') ?: 1);
- Add the Bedrock multisite URL fixer plugin:
composer require roots/multisite-url-fixer
(Optional)
Thank you to Evan Mattson for contributing Bedrock's driver to Valet, and for creating the Valet WP-CLI command.
Thank you to Craig for the multisite subdirectory driver.
Contributors
Last updated
Support Roots
Help us continue to build and maintain our open source projects. We’re a small team of independent developers and every little bit helps.
Sponsor Roots on GitHub