Create a Fresh Laravel Project Using Lando.dev

Setting up a consistent and reliable local development environment is crucial for any software development project. In this guide, I'll walk you through the process of creating a new Laravel project using Lando.dev, a Docker-powered development tool that simplifies local development.

Lando provides the following benefits:

Let's dive into the steps required to set up a new Laravel project with Lando:

1. Create a New Laravel Project

Start by running the following command in your terminal to create a new Laravel project:

composer create-project --prefer-dist laravel/laravel my-laravel-app

This command sets up a new Laravel project in the my-laravel-app directory.

2. Initialize Lando

Navigate to your project directory:

cd my-laravel-app

Then, initialize Lando with the following command:

lando init

Lando will prompt you to select a recipe. Choose the laravel recipe and proceed with the setup.

3. Customize Your Lando Configuration (Optional)

The default .lando.yml file should work for most projects, but you can customize it further. Here’s an example:

name: my-laravel-app
recipe: laravel
config:
  php: 8.2
services:
appserver:
    type: php:8.2
    build_as_root:
      - curl -sL https://deb.nodesource.com/setup_22.x | bash -
      - apt-get install -y nodejs
tooling:
  node:
    service: appserver
  npm:
    service: appserver
  npx:
    service: appserver

4. Start the Lando Environment

To start your environment, simply run:

lando start

Once started, Lando will provide a local URL where you can access your Laravel application.

5. Working with Your Laravel Project

Lando simplifies working with Laravel by providing commands like:

6. Stop the Lando Environment

When you're done, stop the environment with:

lando stop

With Lando, you can ensure that your development environment is both powerful and flexible, making Laravel development a breeze. Happy coding!