Laravel Valet
Programming #Laravel Valet# Laravel

App development is big thing but, to make the environment ready is not a simple and steady task. Sometime you can set up your development environment in minutes but, sometimes developers struggle around to make it ready. In PHP, there are few popular developing environment like XAMPP and MAMPP are there which is almost available for every platform but today, we have come to a point where we have portable virtual boxes that can be used to develop and deploy applications. So, there’s always been a fight to set up development environment mostly in Mac. So to make that set up quick Laravel introduces the Laravel Valet

Laravel Valet – Introduction

Laravel Valet is a development environment that runs without Nginx and Apache. Valet is helpful for those old machines with not much RAM or for developers who doesn’t want some servers to consume unnecessary RAM. It is currently available for mac and that configures your Mac to always run PHP’s built-in web server in the background when your machine starts. Valet is a layer written upon the Caddy server to make setting up a Laravel and some other supported framework environment easier. Also its uses Dnsmasq to map every .dev domain to your code directories. Suppose one of your project is in directory /var/www/test_project/ then you will be able to access your project at ` as Dnsmasq maps your project directory.


Installation is very simple. Install Homebrew if not installed. Then install PHP70 using Homebrew

brew install php70`

Sometime you might get error that No similarly named formulae found. Its just because your Homebrew might not be updated or formulae not yet included so run

brew update

brew install homebrew/php/php70

Now install Valet from composer (Globally)

composer global require laravel/valet


valet install or valet start

Note: valet install command you need to run only once, it sets the valet’s daemon and valet will automatically start when system starts.

Configure your Project directory Now valet is installed and its time to serve your first project. So let’s say you have web directory in /var/www/ so cd into that folder and type

valet park 

This command will register your current working directory as a path that Valet should search for sites. Lets say you’ve Test_Project app in your current folder /var/www/ then now you’ll be able to use in your browser. Also, there’s not any end to it. Valet made simple and pretty easy if you want to use valet without parking some specific directory that is if you have any other application and you want it to be served using Laravel Valet, you can do that.

valet link app-name

and after linking you should probably be able to visit the development application using in your browser.

Sharing sites

So, how about sharing your site with your friends and people out there or to test out webhooks, payment gateway etc ? Valet does that for you by running a simple command.

valet share Test_Project You’re done now. After hitting this command vallet will copy the share link into clipboard and show you some tunnel link and http request. By sharing sites this gives you an added bonus of being able to use the share URL to test webhooks from services like Stripe, Mailgun, etc. Perfect for local development when testing webhooks are usually tricky. Also, Behind the scene valet uses ngork to setup tunnel with rest of the world.

Securing your site

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 you’re building something which needs secure connection like payment gateways, you can do that with one command.

valet secure Test_Project Voila, you’re done now. now your site will be accessible using SSL.

Wrapping up

There are lots of cons and pros of valet, but few things like valet secure, valet share is great feature so far. For ssh you might get yourself into some manual setup which results to be hectic and problematic in the end. Also for database, it doesn’t comes with any database in it like vagrant or homestead rather you’ll have to install your db like maria db or any equivalent. To cut the cackle I would suggest to give the Valet a try and I’m sure you gonna love this.

3 minutes read 12th Aug 2016


A entrepreneur, running an early stage venture, VizitDoc and a MVP-First Service Based Companay ThecodeWork.

A dreamer, having care for alternative education.

Archives - 1

  • Code

    20 Articles

    List of code snippet and articles I wrote when I started blogging in early 2016 😃

Codementor badge