Valet+ is a development environment for macOS. No Vagrant, no Docker, no /etc/hosts
file. Yeah, we like it too.
Valet+ configures your Mac to always run Nginx in the background when your machine starts. Then, using DnsMasq, Valet+ proxies all requests on the *.dev
domain to point to sites installed on your local machine.
In other words, a blazing fast development environment. Valet+ provides a great alternative if you want flexible basics or prefer extreme speed.
Some key differences compared to Valet:
- PHP version switch
- Xdebug (on/off mode)
- PHP extensions (mcrypt, intl, opcache, apcu)
- Optimized PHP configuration using opcache
- Mysql (with optimized configuration)
- Redis
- Elasticsearch (optional)
- Many more features outlined below...
- Introduction
- Installation
- Switching PHP version
- Xdebug
- Database
- Redis
- Open project in browser
- Securing Sites With TLS
- Valet drivers
- Valet Documentation
- Credits
⚠️ Valet requires macOS and Homebrew. Before installation, you should make sure that no other programs such as Apache or Nginx are binding to your local machine's port 80.
- Install or update Homebrew to the latest version using brew update.
- Install PHP 7.0 using Homebrew via
brew install homebrew/php/php70
. - Install Valet+ with Composer via
composer global require weprovide/valet-plus
. Make sure the~/.composer/vendor/bin
directory is in your system's "PATH". - Run the
valet install
command. This will configure and install Valet+ and DnsMasq, and register Valet's daemon to launch when your system starts. - Once Valet is installed, try pinging any *.dev domain on your terminal using a command such as
ping foobar.dev
. If Valet+ is installed correctly you should see this domain responding on127.0.0.1
. If not you might have to restart your system. Especially when coming from the Dinghy (docker) solution.
ℹ️ Valet will automatically start its daemon each time your machine boots. There is no need to run
valet start
orvalet install
ever again once the initial Valet+ installation is complete.
ℹ️ To update Valet+ to the latest version use the
composer global update
command in your terminal. After upgrading, it is good practice to run thevalet install
command so Valet can make additional upgrades to your configuration files if necessary.
Once Valet+ is installed, you're ready to start serving sites. Valet provides a command to help you serve your sites: valet park
. Which will register the current working directory as projects root. Generally this directory is ~/sites
.
- Create a
sites
directory:mkdir ~/sites
cd ~/sites
valet park
That's all there is to it. Now, any project you create within your "parked" directory will automatically be served using the http://folder-name.dev convention.
For example:
mkdir ~/sites/example
cd ~/sites/example
echo "<?php echo 'Valet+ at your service' > index.php"
- Go to
http://example.dev
, you should seeValet+ at your service
Switch PHP version using one of there commands:
valet use 5.6
valet use 7.0
valet use 7.1
Xdebug support is build in. It works on port 9000
after you enable it.
Enable Xdebug:
valet xdebug on
Disable Xdebug:
valet xdebug off
⚠️ Xdebug makes your environment slower. That's why we allow to fully enable / disable it. When not debugging it's best to disable it by runningvalet xdebug off
.
To use Xdebug with PHPstorm you don't have to configure anything. Just run valet xdebug on
and click the Xdebug button on the top right:
Then install Xdebug helper for Chrome and enable it when viewing the page you want to use Xdebug on.
Valet+ automatically installs mysql 5.7 with 5.6 compatibility mode included. It includes a tweaked my.cnf which is aimed at improving speed.
Username: root
Password: root
Create databases using:
valet db create <name>
When no name is given it'll try to find the closest git repository directory name. When it can't find one it'll use the current working directory name.
valet db create
Drop a database using:
valet db drop <name>
When no name is given it'll try to find the closest git repository directory name. When it can't find one it'll use the current working directory name.
valet db drop
Drop and create a database using:
valet db reset <name>
When no name is given it'll try to find the closest git repository directory name. When it can't find one it'll use the current working directory name.
valet db reset
Export a database:
valet db export <database> <filename>
When no database is given it'll try to find the closest git repository directory name. When it can't find one it'll use the current working directory name.
When no filename is given it will use <database>.sql
.
Import a database with progress bar
valet db import <filename>.sql <name>
When no name is given it'll try to find the closest git repository directory name. When it can't find one it'll use the current working directory name.
Valet+ has first class support for opening databases in Sequel Pro, a popular MySQL client for Mac.
valet db open <name>
When no name is given it'll try to find the closest git repository directory name. When it can't find one it'll open Sequel Pro without pre-selected database.
valet db open
Mailhog is used to catch emails send from php. You can access the panel at http://localhost:8025.
Redis is automatically installed and listens on the default port 6379
. The redis socket is located at /tmp/redis.sock
Elasticsearch can be installed using:
valet elasticsearch install
It will run on the default port 9200
.
Open current git project in Tower
valet tower
Open current git project in PHPstorm
valet phpstorm
Open current git project in Visual Studio Code
valet vscode
To open the current project in your default browser:
valet open
valet ssh-key
Automatically configure environment for the project you're in.
valet configure
Automatically configure the base url / elastic search configuration in the database for Magento 2.
By default, Valet serves sites over plain HTTP. However, if you would like to serve a site over encrypted TLS using HTTP/2, use the secure command. For example, if your site is being served by Valet on the example.dev domain, you should run the following command to secure it:
valet secure example
To "unsecure" a site and revert back to serving its traffic over plain HTTP, use the unsecure command. Like the secure command, this command accepts the host name that you wish to unsecure:
valet unsecure example
The nginx-error.log
and mysql.log
are located at ~/.valet/Log
.
Other logs, including the PHP error log, are located at /usr/local/var/log
Valet uses drivers to handle requests. You can read more about those here.
By default these are included:
- Static HTML
- Magento
- Magento 2
- Symfony
- Wordpress / Bedrock
- Laravel
- Lumen
- CakePHP 3
- Craft
- Jigsaw
- Slim
- Statamic
- Zend Framework
A full list can be found here
Documentation for Valet can be found on the Laravel website.
This project is an improved fork of laravel/valet. Thanks to everyone who contributed to this project.
- Tim Neutkens (@timneutkens)