Go to menu Skip to content
Home
blogue | Blog | What is the best Laravel development environment ?

What is the best Laravel development environment ?

Photo de Mathieu Savage
Mathieu Savage
8 min
·
19 Dec, 2024

In the ever-evolving world of web development, having the right tools can make all the difference. Whether you’re a seasoned developer or just starting out, choosing the best development environment for your Laravel projects is crucial. At Libéo, we understand the importance of efficiency and ease of use, which is why we’ve explored various options to find the perfect fit.

Laravel, our favorite PHP framework, offers a plethora of tools designed to streamline your development process and help you ship code faster. But what if we told you that our favorite development environment is one we’ve crafted ourselves right here at Libéo? Enter Kubeo, our custom solution that leverages the power of Docker to simplify and enhance your development workflow.

In this article, we’ll take you on a journey from the early days of manual setups with tools like XAMPP to the modern, containerized world of Docker. We’ll explore the strengths and weaknesses of popular Laravel development environments such as Laravel Herd, Sail, Homestead, and Valet. Finally, we’ll introduce you to Kubeo, our in-house solution that has revolutionized the way we develop Laravel applications.

Long way from XAMPP

The Good Old Development Environment

For those of us who remember the days before Docker, setting up a development environment was a manual and often tedious process. Back then, tools like PHPStorm and VSCode were not yet available, and we relied on Notepad++ and XAMPP.

So what exactly is XAMPP ? It’s software that allows you to configure and run a suite of services essential for a PHP application such as Apache, MySQL, and of course, PHP itself.

Now let me be clear, I think that XAMPP is a great tool to support local PHP development. But in reality, when you are working on collaborative projects, like an API or a simple web application, setup is complicated. It’s not everybody’s cup of tea, some people, like me, just want it to work simply and be able to commit code ASAP ! Also, configuration differences between local and deployed environments can cause significant issues.

But… it works on my machine ! Yes, but… yeah.

The Docker Ecosystem

Today, most people have at least, heard of Docker. But really, what is it ?

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code, you can significantly reduce the delay between writing code and running it in production.

Quoted from https://docs.docker.com/get-started/docker-overview/

Being able to skip the configuration step, covering your entire PHP stack with a single configuration file. Using official Docker Containers that are maintained by the Docker community is something truly remarkable.

Docker runs on Mac, Windows, Linux, even works great with WSL within Windows ! Software like Docker Desktop offers an easy user interface to be able to simplify Docker configuration.

However, Docker alone isn’t the complete solution. That’s why Laravel offers multiple tools to help developers simplify their web development pipelines. Let’s take a look.

Laravel’s official offerings

Laravel development tools are plenty, and all have their own pros and cons. There’s a lot to read out there, so here’s a quick summary of Laravel’s offerings:

Laravel Herd

Laravel Herd is a one-click PHP development environment created by Beyond Code in collaboration with Laravel. It is designed to be superfast and easy to use.

  • Pros:
    • Supports multiple PHP versions.
    • Easy to switch between PHP versions.
    • Allows running applications locally with SSL.
    • Easily share local applications using Expose.
  • Cons:
    • Does not come with database management tools.
    • Pro version is expensive

Laravel Sail

Laravel Sail is an official Docker-based development environment for Laravel. It provides a simple command-line interface for interacting with Docker.

  • Pros:
    • Pre-configured Docker containers for PHP, MySQL, Redis, and more.
    • Easy to set up and use.
    • Highly customizable through Docker Compose.
  • Cons:
  • Requires knowledge of Docker.

Laravel Homestead

Laravel Homestead is an official Vagrant box that provides a full-featured development environment with PHP, Nginx, MySQL, and Redis pre-installed.

  • Pros:
    • Provides a consistent development environment.
    • Supports multiple PHP versions.
    • Isolated environment prevents conflicts with other local software.
  • Cons:
    • Requires Vagrant and VirtualBox, which can be resource-intensive.
    • Setup can be more complex compared to other tools.

Laravel Valet

Laravel Valet is a lightweight development environment designed for macOS users. It runs Nginx in the background and uses DnsMasq to route requests on the *.test domain to local sites.

  • Pros:
    • Lightweight and fast with minimal resource usage.
    • Supports multiple PHP versions.
    • Seamless integration with other tools like Ngrok and Expose.
  • Cons:
    • Limited to macOS.
    • Less isolation compared to virtualized environments, which may cause conflicts with other software.

What about us ?

What excites us at Libéo ? Which development environment did we choose, and which solution offers the best functionalities to power our Laravel applications?

None ! Our favorite Laravel development environment is our own software called Kubeo!

Kubeo & Docker

Kubeo is software written in Go, acting as a wrapper around Docker Compose. But where did it come from ?

One of our biggest challenges was the initial setup of our Laravel projects—or any projects, for that matter. The variety of projects types here at Libéo was giving us headaches, as each individual project had its own unique needs.

Kubeo addresses these issues by harmonizing PHP versions from local to production, automating dependency installation, normalizing compiling tools, standardizing MySQL databases and accesses, enabling plug-and-play debugging, containerizing Node, and providing before-and-after scripts, custom commands, connected pipelines, and Kubernetes access. Kubeo does a lot for us!

The basic requirement for Kubeo is to have Docker installed on your device. Docker Desktop is a simple, user-friendly software to help you start, stop and configure Docker.

Linux, Mac or Windows

One of the best parts of Kubeo is that it works on of every platform. Maintained on our self-hosted GitLab platform (an open-source alternative to GitHub), our DevOps developers maintain and deploy Kubeo through custom pipelines, releasing versions that support both AMD64 and ARM architectures. Whatever the development environment, Kubeo is easily installed and allows you to work on your new project in seconds.

Why it works for us

The core idea behind Kubeo is to eliminate the setup process of a web application. A simple command is required to start the complete stack:

And that’s it ! But really, what does it actually do ? There are three major steps: Before, Docker Compose Up, and After. The Before and After steps are 100% configurable and can differ from project to project. Here’s the flow:

  • Before: This step is usually where we copy and prepare files before the Docker containers are brought to life. Whether it’s copying basic environment files or installing dependencies with NPM or Composer, you have the power to prepare the field as you wish.
  • Docker Compose Up: This is where the Docker stack is powered up. A fully set up docker-compose.yml file describes the stack and its full configuration.
  • After: This step is mostly used to interact with the stack. A simple example would be using Artisan to migrate your database, clear cache, or set up the storage link. Of course, being bash, you can add whatever you need for your Laravel project.

Normalized Workflow

Since all our projects are handled by Kubeo, frontend developers, backend developers, seniors and beginners can easily start a project locally. The way Kubeo simplifies having a working development environment greatly improves efficiency in our development workflow.

Kubeo removes the need to install PHP, Composer, Apache, Nginx, Redis, MySQL, Node, Syntax parsers, and is even equipped to share IDE configuration for a specific project. At Libéo, we maintain a pool of custom Docker images, pulled from the official repositories, and apply our own twists to them. This way we can offer high-quality containers to our developers, packaged with all the required customization to support the wide variety of features our clients asks of us.

From Local to Prod

One of the best features of using Kubeo to leverage the configuration of all development environments is that our local Docker images are almost the same as our production environment images. This way, very few surprises occur when pushing code to production, and we can trust our QA team because, of course, they did their job!

Debugging

Since we have total control over our Docker containers, debugging is a breeze to setup. PHP, being our favorite backend development language, is easily configured to be used with the debugging standard, XDebug. Our debugging ports are standardized, and configuration is the same for every PHP project.

After configuring your favorite IDE with the correct port and folder mapping, the debugger is easily accessible and just works!

IDE Agnostic

Do you prefer PHPStorm over Visual Studio Code ? What about Sublime ? Kubeo allows you to pre-package your Laravel project with the perfect configuration. We package our projects with configuration stubs for the most popular code editors, especially VSCode and PHPStorm. These stubs come with required and suggested plugins or modules and various IDE configuration, like proper syntax highlighting for HTML, JavaScript, CSS, and PHP.

Expendable Commands

One of the most powerful feature of Kubeo is the possibility of adding custom commands to a project. Some typical commands would include things like:

  • Composer, executed as a docker command on a custom PHP image
  • Tinker, executed as a docker command on our main PHP project image
  • Sync, allows to synchronise databases and filesystems from environment to environment
  • Mysql, executed as a docker command on the main SQL project image.

Other popular uses for our Laravel projects, are commands to :

  • Execute Laravel IDE Helper to update our models documentation
  • Start a Laravel Reverb process to allow real-time web socket communication
  • Start a Server-Side Node instance for our Inertia project
  • Refactor code with PHPStan
  • Lint code with php-cs-fixer
  • Start a Stripe Webhook listener

Libéo’s Favorite Laravel Packages

Over the years doing web application development, we sure found some great tools and packages in the Laravel ecosystem. For web apps or APIs, we have found a lot of great tools that allow us achieve the best possible result. Here’s a couple of them, to help you on your Laravel journey:

Conclusion

In the near future, Libéo hopes to open-source Kubeo, as Open-Source software is really at the heart of Libéo’s culture. We use open-source software daily, and really believe in it’s necessity, so we sure hope to be able to share this fantastic tool with you all one day.

In the meantime, I would suggest you to explore Laravel Sail. It is quite close in principle to Kubeo, and I believe that every developer should explore the inner-workings of the fantastic Docker environment, how to build your own Docker images, how to debug inside containers, connect multiple services inside a Docker network and so on. By doing so, you’ll be well-prepared to leverage Kubeo’s capabilities when it becomes available, and you’ll gain valuable insights into modern development practices that can enhance your projects today.

Similar articles

Retour au haut de la page