Laravel Valet? What is it?
I am using Laravel Valet to install Nginx and a domain masking service that will allow us to access our localhost address (127.0.0.1) from a domain like mysite.test.
Valet is helpful for people who have a very low configuration laptop or PC. I use a MacBook Air with 8GB RAM and 128GB SSD. I have to keep my RAM available for Chrome, so I can’t provide enough resources for the local server. This is why I use Valet instead of Xampp or Mamp. It just uses 7 MB of RAM and really fast compared to any other local server solution, and I really love the domain masking and SSL feature.
You can read more about Laravel Valet here https://laravel.com/docs/5.8/valet
Steps for zombies
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install php
brew install mariadb
Download the composer from here https://getcomposer.org/installer
- Rename the file to
composer.phar
php composer.phar
mv composer.phar /usr/local/bin/composer
composer global require laravel/valet
export PATH=$PATH:~/.composer/vendor/bin
Go to the folder you will be using as your development directory
valet install
valet park
Explanation of what each command does
1. I have installed Home Brew. It helps to install and remove programs easily. The commands you see in step 2 and 3 are done with the help of Home Brew. Without installing Homebrew, the commands will not work.
2. We are installing PHP. I work with WordPress plugins and themes and test several of them daily.
3. I am installing MariaDB. I used to use MySQL before (I guess) but heard that MariaDB is faster, so I have been using it since 2019.
4. We are downloading composer, a command line tool to help install PHP packages.
5. Rename it to Composer so we can access it easily from the command line.
6. Now we will check if the file is working correctly. After running the command from the terminal, we will see the available commands, confirming that it is working perfectly.
7. Now is the time to move the file to a directory from where we can use the command without writing the file extension (.phar).
8. It’s time to add Laravel Valet to our PHP packages.
9. Adding the path to the list will help us access the PHP packages from the command line. For example, we will be able to access the valet
command from the terminal after running this command.
10. Now, we need to find a folder to keep all our website files. The folder can be anywhere you like. Desktop or user folder doesn’t matter.
11. Running this command means we tell Valet I will use this folder as my web server.
12. This one tags the folder as the root folder and will look for sites inside here. For example, I have created a folder named themeum and installed Valet in that folder. So it is the root folder. Inside themeum folder, I have created folders named crowdfunding, tutor, megamenu.
After this step, my web server is ready, and I can access the content inside the crowdfunding folder from crowdfunding.test
domain.
Valet Commands
valet start
to start the server. By default, it is running in the background.
valet stop
command stops the server. If you are very low in resources, you should stop it after you use it.
Leave a Reply
You must be logged in to post a comment.