How to install Laravel Valet to Mac ?

Enver Şanlı
2 min readOct 29, 2021

--

Hello everyone !

I found a useful Laravel Package that provides an easy development environment like Nginx to your device. Valet will be running Nginx on your device when you start your Mac.

Valet lets you swipe PHP version easily too. I had a problem with that because I have projects which have different Php versions. It’s sometimes a problem that you always change PHP versions in different ways. Valet makes it easier, just a few lines in your Terminal! You can install any PHP version and swipe easily between them.

And the other hand, Valet uses very low memory on your device!

Firstly, you need to install brew to your Mac to install the valet. You can follow the below link to install Homebrew.

Laravel Valet

Follow the steps to install Valet. You need to run the below command on your terminal.

1 — Update Brew

brew update

2 — Install PHP

brew install php

3 — Get Valet with Composer

You need to be sure, you are on this path to keep installing (~/.composer/vendor/bin). When you swipe that path, you will see a valet file if you run ls -l command in your terminal. After that, you can get valet by running the below command.

composer global require laravel/valet

4 — İnstall Valet

After that, you are ready to install VALET PACKAGE to your Mac !

valet install

Finally, you installed an easy environment on your device. You can check that in your browser. (127.0.0.1)

How to use Php Version with Valet ?

You have installed the Valet package on your Mac. Now, you will use PHP version that you want to use for your project. Let’s see how it works.

valet use php@7.2

valet php@php.version

If you run the above command, you will be using PHP 7.2 version. You can check it by displaying PHP version in your terminal.

php --version

It’s all but What if you want to use another PHP version ? Just run similar command in your terminal and use any version of PHP.

valet use php@7.4

and run;

php --version

You will see PHP 7.4 is active on your device ! Your development environment is ready to use!

I hope you will like it too! I use that and I wanted to share that experience with you all.

Enjoy Your Coding !

Resources :

Enver ŞANLI

Laravel Developer, Farmer & Social Thinker

--

--

Enver Şanlı
Enver Şanlı

No responses yet