Choosing a local development environment for laravel is crucial as it directly impacts the productivity of the developers and helps them easily run their laravel applications locally. The laravel team spent years building tools to help developers setup their laravel local development environment as quick and easily as possible. Here, I will be covering all the five different laravel local development environment tools and help you decide which one is best for your use case. The following are the list of official laravel web development environments released so far.
- Laravel Herd
- Laravel Sail
- Laravel Valet
- Laravel Homestead
- Artisan Serve
1. Laravel Herd
Laravel Herd is the latest development environment released by Beyond Code in collaboration with Laravel. Herd advertises themselves as
One click PHP development environment which I believe is true. I was able to install Herd directly from the Laravel Herd Website and able to run all of my existing Laravel(and Jigsaw) applications without any additional configuration. I just added the root path of all of my projects to the Herd's path configuration, and it automatically created local testing urls for each of the application.
Laravel Herd allows developers to run multiple PHP web applications and each of them can run on different PHP versions. Herd also makes it very easier to switch the PHP version on the command line which makes it a very good choice for developers who are working on more than one project.
Laravel Herd Highlights
- Superfast local development environment
- Running applications locally with SSL is a breeze
- Switch between multiple PHP versions
- Migrate your existing Laravel Valet applications easily to Herd
- Easily share your local applications with public using
Exposewhich comes out of the box
Laravel Herd Limitations
- Laravel Herd supports only macOS
- Doesn't come with Database management tools. Although herd recommends using DBngin
- Laravel Herd currently supports PHP7.4 and newer versions. If your application is running older PHP version, Laravel Herd might not be compatible.
- Herd comes with default PHP extensions installed and currently there is no way to enable additional extensions.
Overall Herd is a great choice for you if
- You are using MacOS
- You are running more than one application with different PHP versions
- All of your applications run on PHP7.4 or higher
- You do not need any PHP extensions more than what is currently shipped with Laravel Herd
2. Laravel Sail
Laravel Sail is an official docker based web development environment for Laravel. If you love containers, You will love Laravel Sail. It's a feature rich pre-packaged docker container which provides support for PHP, Composer, MySQL, Redis, MeiliSearch and MailPit out of the box. Since it's a docker container, You can extend it to install any other services you may wish.
When running your applications with Sail, Your apps run on a docker container and completely isolated from your computer.
Laravel Sail Highlights
- Docker based development environment
- Out of the box installation for PHP, MySQL, Redis, MeiliSearch, MailPit and MinIO
- Supports all operating systems(Windows, Linux and MacOS)
- Easily share your local applications with public using a single command
Laravel Sail Limitations
- Dependent on docker
- Laravel Sail currently only supports PHP8.0 and newer versions.
- If you are running more than one application, and they need to talk to each other, Then you need to tweak the configuration for your apps to work.
Overall Sail is a great choice for you if
- You are using Windows / Linux
- You are running one or less applications which doesn't need to talk to each other
- All of your applications run on PHP8 or higher
3. Laravel Homestead
Laravel Homestead is an official pre-packaged vagrant box which comes with most commonly used tools and services which are required to run a PHP or Laravel application.
Vagrant boxes are lightweight virtual machines which can be created and disposed easily. So developing applications using laravel homestead allows developers to experiment and dispose the virtual machines easily without affecting their system.
Containers are evolving, and it had become an industry best practice to use containers instead of virtual boxes. If you are a new developer starting with Laravel, It is recommended to start with either Laravel Herd or Sail(Docker).
Laravel Homestead Highlights
- Light-weight vagrant box which can be created and disposed easily
- Out of the box installation for most popular and commonly used services to develop web applications
- Supports all operating systems(Windows, Linux and macOS)
Laravel Homestead Limitations
- Dependent on Vagrant and VirtualBox
- Starting a virtual box is slower compared to Docker
Overall Homestead is a great choice for you if
- PHP or other system requirements for your application aren't supported by Laravel Sail or Herd
- Your application has a restriction on the operating system on which it runs
4. Laravel Valet
Laravel Valet is a minimalistic Web development environment for macOS. Just like Herd, Valet allows developers to run multiple PHP web applications and each of them can run on different PHP versions.
With the release of Laravel Herd and official mention of Herd in the Valet docs, There are very good chances that Laravel Herd will replace Laravel valet in the near future. So, i would recommend to start using Herd instead of Valet.
Laravel Valet Highlights
- Memory Efficient. Only takes 7MB of RAM
- Supports older PHP versions which are not supported by Laravel Herd
Laravel Valet Limitations
- There are very good chances that Laravel Herd will replace Laravel Valet
Overall Laravel Valet is a great choice for you if - You are using macOS - Your applications are running an older PHP version which is not supported by Laravel Herd
5. Artisan Serve
Serve isn't a Web development environment but instead a laravel artisan command which uses PHP's built-in web server to quickly run and preview the application. By executing the
php artisan serve command, One can easily preview their laravel application without depending on a development environment.
Artisan Serve Highlights
- Allows developers to quickly preview their laravel applications without depending on a Web development environment
Artisan Serve Limitations
- Developer have to manually install PHP, MySQL and other required services
- Not a replacement for a Web development environment
Overall Artisan Serve is a great choice for quickly previewing your laravel applications without the need to setup them beforehand
Side By Side Comparison
|Laravel Herd||Laravel Sail||Laravel Homestead||Laravel Valet||Artisan Serve|
|Operating System||macOS||Linux, Windows, macOS||Linux, Windows, macOS||macOS||Linux, Windows, macOS|
|PHP versions||>= 7.4||>= 8.0||>= 5.6||>= 5.6||>= 5.6|
|Multiple PHP Versions||Yes||Yes||Yes||Yes||Yes|
|Additional PHP Extensions||No||Yes||Yes||Yes||Yes|
|Who is it for?||macOS users who are using PHP7.4 or higher||Any user who need advanced control over services they use||Linux/Windows users who have operating system dependencies||macOS users who are using PHP version which is not supported by Laravel Herd||Any user who wish to quickly preview the laravel application without setting up a development environment|
There is no one size fits for all solution. Every development environment is unique in their own way. If we have to choose one, I believe the best choices are
- Laravel Herd for macOS
- Laravel Sail for Windows / Linux.