DEV Community

loading...

Using Laravel Valet On Linux/Ubuntu! 🐘 🔑

andrewbrooks profile image Andrew Brooks 👨‍💻 Updated on ・1 min read

Valet is an elegant way to create a local webserver for testing your Laravel applications on Mac.

Fortunately there is a fork allowing us to use Valet on a Linux based OS as well thanks to @cpriego.

Let's get started.

Helpful Links

Prerequisites

Installing Dependencies

sudo apt-get install php7.3-curl
sudo apt-get install jq
sudo apt-get install xsel
sudo apt-get install libnss3-tools

Installing Valet

composer global require cpriego/valet-linux
test -d ~/.composer && bash ~/.composer/vendor/bin/valet install || bash ~/.config/composer/vendor/bin/valet install

Restart your terminal

Serving your project

cd into project root and run the following command

valet park

The web URL generated will be {project_folder_name}.test.

For example:

laravel new blog

cd blog

valet park

will provide a working URL of blog.test

Things to remember

If you have a local Apache serve running you need to disable it or your Valet URLs will lead to the Apache welcome page.

sudo systemctl stop apache2
sudo systemctl disable apache2

To un-park a project cd into the root and run

valet forget

I'm Andrew, a full stack software developer from the deep south who makes internet things.

Hit me up on twitter @andrew_brooksie

Reach out if you have any questions or requests for future write-ups!

Discussion

pic
Editor guide
Collapse
sahilkashyap64 profile image
Sahil kashyap

Also if you want to restart the apache2(I had difficulting while restarting apache)

  1. Turn off the nginx
sudo service nginx stop
  1. Then enable the apache
sudo systemctl enable apache2
  1. then
sudo systemctl start apache2  

or

sudo systemctl restart apache2  
Collapse
riliwanrabo profile image
Riliwan

is valet php.ini different from the local system's ?