DEV Community

Cover image for The current state of local Laravel development
Andrew Schmelyun
Andrew Schmelyun

Posted on • Originally published at

The current state of local Laravel development

Right now there's a lot of options when it comes to working with Laravel on a local development environment. Where there used to be only a handful of options, there's now over a half dozen officially supported ones.

In this article, I'm going to try and give a brief synopsis of each of them, provide some pros and cons, and include a basic high-level overview of what you'll need to get started with each.

Want to skip ahead to a particular area? Here's a list of the methods we'll be talking about:

Alright, let's dive right into it!

Install a server stack locally

The old tried and true, installing a full LAMP stack directly on your local development hardware. On a Linux (and to some extent, MacOS) machine, it's not that difficult. For Windows users who aren't using WSL however, it can be a little complex if you're not using a pre-built software like WAMP.

What I like about this method:

  • It's the fastest response time since you're running directly on the machine
  • The full stack is ready to go as soon as your computer boots up
  • You have the full resources from your machine available to the software stack

What I don't like:

  • Upgrading your OS can break things like Apache or MySQL
  • It can be difficult to get multiple sites running at the same time
  • Hardware differences between local and production environments can potentially cause deployment issues

Despite the negatives, this is still a solid way of creating a local Laravel development environment. Getting started can take a bit of time, but it's a pretty straightforward process. You'll be installing Apache, MySQL, and PHP, setting up vhosts rules pointing to a local domain name, and finally enabling the PHP extensions that your application requires.

The best tutorials I've found for this method are as follows for each OS:

After running through the installation and setup process, all you'll have to do is ensure your Laravel app is under the correct path that you set in your web server config, and you should be good to go!

Vagrant and Homestead

Homestead is an official Vagrant box released by Laravel to help you get a local, containerized environment set up fast. If you're unfamiliar, Vagrant is an application that helps you provision and manage virtual machines, capable of replicating the full stack of software required by your application.

What I like about this method:

  • Creates isolation between your local hardware and software, and what's required by your application
  • Easy to get started with a handful of commands
  • Can provision a portion of your system resources, ensuring that your application doesn't use anything in excess

What I don't like:

  • Even small virtual machines take up a proportionately large amount of system resources
  • Response time can be delayed since the filesystem is separated by a virtualization layer
  • Vagrant has largely fallen out of favor in most applications for Docker and other modern containerization software

Although some may consider that Vagrant is outdated, being replaced by more modern containerization software, it's still a battle-tested enterprise solution that's been powering and deploying production applications for over a decade.

To get started, all you'll have to do is:

After that, your Laravel application should be available to your browser at localhost. There's also a variety of optional services that are brought up with the virtual machine and exposed to your local system (like MongoDB, Mailhog, and Minio).

artisan serve

This method follows a similar path as the local server stack, as far as requirements goes, except that essentially you can skip over installing a web server.

You will need to have both PHP and MySQL (or your database of choice) installed on your local machine. Behind the scenes it's using PHP's built-in web server to power the command and expose the default port of :8000 to your local machine.

What I like about this method:

  • It couldn't be much simpler to get the development server started
  • No installation or configuration of a local web server (like Apache)
  • Very resource-light

What I don't like:

  • Response time for large requests can be pretty long
  • The web server runs one single-threaded process, so applications will stall if a request is blocked.

In my opinion, if you're just running a single local instance of a development application, this method should work well for you. Combined with something like Ngrok or Beyond Code's Expose for domain masking of your development port, and you're good to go.

To use this method, all you have to do is open a terminal and cd to the project directory of your Laravel app. Once there, run:

php artisan serve
Enter fullscreen mode Exit fullscreen mode

Optionally, you can specify the port like this:

php artisan serve --port=8808
Enter fullscreen mode Exit fullscreen mode

You should be notified that a local Laravel development server has been started at (unless you specified a different port). Open it up in your browser, and you're off!


The newest addition to the official local Laravel development family, Sail is a command-line interface that helps you set up, configure, and interact with a default Docker dev environment.

You have the choice of either installing Sail alongside an existing application, or using it to bring up a brand new Laravel app. Sail allows you to run PHP, Composer, npm, and artisan commands without having to have anything installed on your local machine except Docker.

What I like about this method:

  • Zero dependencies need to be installed besides Docker
  • Multiple applications can be running at the same time
  • Easily build files for production with the sail:publish artisan command

What I don't like:

  • Response time for local Docker instances can be notoriously slow, especially on MacOS (although it's being worked on)
  • Because of its aim toward simplicity, Sail can be a little difficult for newcomers to customize out of the box

That being said, it's a fantastic place to start if you've always wanted to try out Docker, or just don't want to have any dependencies installed on your local system. Using this, you can get a full stack web server up and running in minutes.

If you'd like to try it out for yourself, it's pretty straightforward. For existing applications, just run:

composer require laravel/sail --dev
php artisan sail:install
./vendor/bin/sail up
Enter fullscreen mode Exit fullscreen mode

And if you'd like to use Sail to create a new application from scratch:

curl -s | bash
cd my-app && ./vendor/bin/sail up
Enter fullscreen mode Exit fullscreen mode

Both of those options will spin up a network of Docker containers using Docker Compose, and expose your application to localhost:80.


Note: This option is just for MacOS users.

Laravel Valet is a slick, fast, and resource-light development environment that combines Nginx and DnsMasq to proxy all requests to .test domain names, pointing them to sites available at a predetermined path on your machine.

There's still a few dependencies required, but not as much as a full web server stack. You'll need Brew, PHP, and Composer to get started, as well as some kind of local database (e.g. MySQL or PostgreSQL). Laravel's official docs recommends using DBngin to get that set up.

What I like about this method:

  • It's blazing fast, as everything is running on your local machine like the first method
  • Very little system resources are used for the web server, averaging around 7MB of RAM
  • Comes with a wealth of commands to manage your local sites and even switch versions of PHP

What I don't like:

  • Extensive PHP requests can still take up system resources and bog down your machine
  • Does not come with any database management out of the box
  • Automatically proxies all .test domains, so you're unable to use that domain on an application not using Valet

Valet might be slowly getting replaced by newer containerization methods like Homestead and Sail, but it's still a powerful tool to bring up and manage Laravel apps in development.


Branded as a "full PHP development environment for Docker", Laradock is a powerful and feature-rich set of configuration files for local Laravel development with Docker.

This package has been around for a few years, and as such has become one of the de-facto standards used to create both local dev environments and assist in production deployments of Laravel apps.

What I like about this method:

  • Contains pretty much any service you could possibly use in a Laravel application, out of the box
  • Configured for both local and production environments, allowing you to easily deploy your application to a server running Docker
  • Includes step-by-step documentation for setting up xDebug

What I don't like:

  • Like with Sail, response time can vary and tends to be on the slower side when compared with other methods in this article
  • Tends to be a little bloated, as it's grown over time and expanded beyond just Laravel
  • Can be difficult to customize, especially for Docker beginners

The documentation for Laradock is... extensive, to say the least. However it pretty much boils down to:

  • Install Docker for your OS
  • Use git to clone the Laradock repo
  • Copy the env-example file to .env in your project root
  • Modify the new .env file with services you want

After you've completed those steps, it should be as simple as running this command from your project root:

docker-compose up -d nginx mysql
Enter fullscreen mode Exit fullscreen mode

As described in their docs, when bringing up a container like nginx, it's dependent on the php-fpm service. There's no need to specify php-fpm in the up command, as it'll be brought up alongside automatically.

From there, you'll just have to dig through the documentation and learn to use whatever services your Laravel application depends on. There's separate areas for caching with redis, setting up Traefik, or running artisan commands. It might take some time to get fully set up to your liking, but once you do it's a powerful environment with zero local dependencies necessary.

Roll your own Docker setup

Our last, and my personal favorite, method for getting a local Laravel development set up, making your own with Docker!

All of the tools above anticipate a generic application's needs and try to wrap it up in a simplistic package for ease of use and access. They're fantastic options, and definite time-savers, if your aim is to get a local environment set up as quickly and painlessly as possible.

However, as a full-stack developer who runs side projects from development through to deployment, I really wanted an excuse to dive into the deeper parts of Docker and create a local environment that would fit my needs perfectly.

That's why I made docker-compose-laravel, and it's what I use as the basis for development environments in all of my Laravel projects.

What I like about this method:

  • Gives you the power to know exactly what services are being used in your local Docker environment
  • Full control and customization of your Dockerfiles and docker-compose.yml files
  • Can easily be set up for both local development and production environments

What I don't like:

  • Requires time and effort to learn a new technology before being able to use it
  • Debugging issues with Docker containers can often be frustrating
  • If using volumes on a non-Linux filesystem, response time for PHP can be fairly slow

Using a combination of resources such as the Docker documentation and guides like this one from DigitalOcean, I was able to piece together an environment that both made sense to me and also matched the services that I needed in my applications.

That's all for now!

These are the seven most talked about methods of getting a local Laravel development environment set up. There's a lot of options out there, and hopefully this guide might help you narrow down one that works best for you!

If you have any questions about this, or any other web development topics at all, please feel free to reach out to me on Twitter or let me know in the comments below.

Top comments (7)

dakira profile image
Matthias Niess

Some additions regarding Valet:

  • Valet does exist for Linux and ist works nicely. It's a fork with pretty much feature parity.
  • Database and other stuff can easily be added with tightenco/takeout
  • you don't have to lose the test domain to Valet, you can easily bind any TLD you like.
masedi profile image
Edi Septriyanto


Thanks for this complete tutorial, it is really helpful for the community.

But, for those who want to install the LEMP stack by yourself, you can use the auto installer tools.

For this, I usually use the LEMPer Stack, it might be useful for auto-installing LEMP stack and at the same time to manage a vps/cloud server for hosting PHP websites without the need for control panel :)

LEMPer Stack

This tool is free and open source, you can contribute to its development via the Github repo =>

Looking forward to your feedback/review..


eduardonwa profile image
Eduardo Cookie Lifter

So you can switch PHP versions with a Valet command? Does that affect the libraries used by Composer on a given project? I often get the error of my PHP version not being compatible with the libraries used by Composer. Its a mess and its still unclear to me why it gets fixed, i dont fully understand it yet. Loved the article 👍

dakira profile image
Matthias Niess

That happens when you have different PHP versions in local and production. E.g. you have PHP8 on your local machine and PHP7.4 in production. When you run composer update, the composer.lock file is created for PHP8. When you run composer install in production, you can't install the dependencies, because they were calculated for your dev machine.

If your server e.g. still runs PHP 7.3, you can run this in your project:

composer config platform.php 7.3.*

It add a section to the composer.json adjusting the dependencies to PHP 7.3. When you run composer update, the composer.lock file will now only get dependencies compatible with your server PHP.

rvxlab profile image

This is a well-written TL;DR of the different ways to develop.

When I started with Laravel in 2014 the go-to way was using Homestead. At that point I was (painfully) developing on Windows. Homestead got the job done but it was slow and painful to work with (not the mention file system issues).

A year ago I was using Laradock on Linux which was considerably better, it was fast and easy to set up. The initial docker-compose build took an ice age and a half however as Laradock is so bloated.

Recently I started using Sail and it’s just perfect. It’s a great stub to start from and since it’s docker you can just add your own services.

Now I see you mentioning that Docker is a tad slow on MacOS. While I can’t speak for that, I can say that on Linux it works really well.

aris profile image
Aris Ripandi

Using container or virtualization good for isolation, but the impact is speed more slower.

Other thing I don't like if using Sail, or another dockerized container: we still need to install PHP, Composer, and Nodejs inside our machine.

Until now, I still using Valet and I love it. But, one thing I don't like is:
PHP-FPM log file are going bigger. In my machine it can be 7 or 8 gb for some couple days :-(

dakira profile image
Matthias Niess

Have you looked at the log file? Something seems to be wrong with your setup. My php-fpm.log never grows bigger than a couple of kilobytes.. and only for errors.