A Few months ago, Tabacitu assigned me a task to install & try Spatie's Browsershot on the Laravel Valet environment. It was the fi...
A Few months ago, Tabacitu assigned me a task to install & try Spatie's Browsershot on the Laravel Valet environment. It was the first time I heard of Laravel's valet. I installed it on my Mac M1 and tested a few local sites. I'm amazed by the experience it delivers.
Valet runs nginx in the background and uses DnsMasq to proxy all requests on the *.test domain to point to sites installed on your local machine. You can use it for many popular frameworks like Zend, CakePHP 3, Magento, Drupal, Joomla, WordPress, Static HTML etc. If you need to support multiple PHP versions across various sites - the steps are here.
I have seen many beginners using XAMPP or MAMP on their system, but struggling for faster response. I was one of them. Why do beginners use XAMPP or MAMP? Because it's difficult to set up
virtual host in the beginning. But using Valet... the setup part is a smooth experience. It's just one command!
In order to install Laravel Valet you'll need: Mac OS & Homebrew. To install Laravel Valet:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install php brew install composer
composer global require laravel/valet
valet installcommand in your terminal to install Valet. This will configure and install Valet on your system.
valet linkcommand. This will register the directory with Valet, and you can access it by visiting http://directory-name.test in your browser.
That's it! You should now have Laravel Valet up and running on your system.
brew install mysql
brew services start mysql
Now, in order to see the tables and entries in those databases, you'll need a database client. You can choose to install a Mac-only app like SequelAce or TablePlus... or, what I prefer to do is to install good old PhpMyAdmin, who has been around for years and served me very well:
brew install phpmyadmin
phpmyadminfolder path and the
configfile path by running:
brew info phpmyadmin
phpmyadminfolder and run
valet link. This will register phpmyadmin directory with Valet and you can access it by visiting http://phpmyadmin.test in your browser.
Note: If you are not using any password for MySQL user, you have to update the config file param
If you don't like PHPmyadmin, that's ok. For example, not all Backpack team members use it. Here are some of the alternatives each one of us uses:
Laravel Valet is an easy-to-install and efficient development environment for macOS. It allows developers to run multiple sites on their local machine without the need for complicated configuration. With the power of Nginx and DnsMasq, Valet provides fast and reliable responses.
By following the simple steps, you can easily set up a local PHP server environment and start building your application.
What do you think about this?
Wondering what our community has been up to?