How to get started with Laravel Valet

Published in Originals on May 16, 2020

Tired of the localhost setup like MAMP, WAMP or XAMP?
Tired of the configuration, ‘etc/hosts’, and stuff like that.

We’ve been experimenting with Laravel Valet for the last months now and decided not to go back.
Its super easy, fast and reliable.

Installation

Before you start, make sure no other service is using port 80.

We’ll get started with installing Homebrew, the latest version of PHP (7.4 at this moment) and Composer

  • You can update your Homebrew with “brew update”
  • Installing the latest version of PHP using Homebrew : “brew install php”

We’re going to install Valet globally to our machine so we’ll use the following command.

composer global require laravel/valet

Once installed we can run valet install...

valet install

Defining the working directory

We need to attach Valet to an directory where we’ll keep our projects.
When navigated to the directory of your choice we can initiate this directory as the Valet directory by using the Park Command.

valet park

Once run, we can create new application projects in this directory.
The directory name of the project will also be the url for Valet. So for example is I have a directory called “pizzawebsite” I can use the URL http://pizzawebsite.test it’s as easy as that…

Sharing projects

It’s even possible to share a project with your team of client.
Thanks to the valet share command a publicly accessible url will be created using Ngrok.

Only Laravel projects? No, many more.

For those of thought Laravel Valet is only for Laravel projects… Nope !
It can be used for Laravel, Lumen, October CMS, Drupal, Craft CMS, Magento, WordPress and many more.



#laravel, #valet