Local development with Valet+
Development has been rapidly growing. In fact, at this stage, it has grown so much that it puts a lot of pressure on developers to become super-humans. However, the developers should do what they’re best at, and that is writing code without having to struggle with a local setup. Luckily, there are tools that help developers focus more on code and less on the environment.
Other tools
Most of us started the easiest way possible, and that is by using one of the environment stack solutions. We never really had to worry about our environment setup. Installing and using tools like MAMP, AMPS, and others was a breeze. Over time projects grew, as well as their requirements. The problems always occurred when added requirements did not come packed with the tool.
Vagrant is slow by default because it runs on virtual machines.
Docker was shown as a good alternative and while its usage is spreading, Mac users do not enjoy the full speed that Linux offers. In addition to that, I don’t find the articles about hacks on how to speed it up useful.
Working with a local setup solved all of my problems. Fully customizable environment, great speed and the opportunity to learn setting everything up from the ground up. The drawback is that it requires lots of time, and if something goes wrong you’re on your own.
Valet+
Valet+ is a fork of Laravel Valet that brings us to the roots: it gives us an opportunity to spend less time working on local setup and more time focusing on the code.
It makes you forget all the hassle of setting up a web server with vhosts, MySQL installation and editing your /etc/hosts file. It runs solely on your Mac, so there is no Vagrant, Docker, NFS or file sync needed to run. In short, it lets you do what you’re great at-writing PHP.
To be more precise, Valet+ is a development environment for macOS. It comes packed with a bunch of tools needed for today’s modern development, easily manageable and optimized for performance. It’s a local setup done via Homebrew that can easily be configured via Terminal. There’s no GUI and there is no need for it. Even if you have minimal knowledge of working with Terminal, you’ll be able to understand how it works.
I’m not here to show how to install or configure it – you can find a lot of information on their GitHub repo. I’m simply here to spread the word about it and to encourage others to make their lives easier.
Features
In the background it runs on NginX with MySQL 5.7 with 5.6 compatibility mode (or MariaDB) and PHP version of your choice. By default it comes with opcache, an optimized php.ini, optimized nginx settings, and a MySQL config tailored for speed. For Magento developers, it comes with n98 magerun and magerun2 preinstalled.
It’s built to have a single root directory for all projects, what is called “parked” directory in Valet. Project directory names are used as domain names with .test or any other TLD name of your choice. Easy subdomain creation for the current working directory is possible with a single command line.
Other available tools:
- Managing databases
- Switching PHP versions
- Securing Sites With TLS
- Mailhog
- Xdebug
- ElasticSearch
- Ioncube
- Redis
- Varnish
Overview
Valet+ has proved to be a really good replacement that I would recommend to anyone using Mac. It is easy to install, easy to configure and even easier to use. That should be enough to at least give it a try. If you still don’t trust me, check out what Phillip Jackson has to say about it. 🙂
I cannot believe how long we’ve lived without Valet Plus in the @magento ecosystem. This is a MUST HAVE for local dev. I can’t stress this enough.
— ??????? ??????? (@philwinkle) April 12, 2018