In this post, we will guide you through the process of setting up a Drupal 10 project using Lando, a powerful local development environment.
Before we begin, make sure you have PHP, Composer, Docker and Lando installed on your system. We'll then download Drupal 10 and configure a basic Lando setup.
Step 1: Install PHP
Ensure PHP is installed on your machine. You can follow the official PHP installation guide for your operating system.
Step 2: Install Composer (Make it Global)
Install Composer and make it globally accessible. You can download it from getcomposer.org and follow the installation instructions.
Step 3: Install Docker
Download and install Docker from the official Docker website.
Step 4: Install Lando
Install Lando by following the instructions on the official Lando website or by using a package manager like Homebrew.
Step 5: Download Drupal 10
Download Drupal 10 to your desired location. You can use git or download the tarball from Drupal's official website.
Step 6: Initialize Lando
Navigate to your Drupal 10 project directory and run the following commands:
$ lando init
Follow the prompts:
- Choose current working directory as the app's codebase.
- Select 'drupal10' as the recipe.
- Set the webroot relative to the init destination as './web'.
- Name your app, e.g., 'my-first-drupal-10-project'.
Step 7: Start Lando
Start your Lando environment:
$ lando start
Step 8: Check Database Information
To access your database, use the following command:
$ lando info
Take note of the database name, password, user, and optionally, the hostname.
Go to your browser and follow the Drupal installation.
Bonus
Step 9: Stop Lando
Stop your Lando environment when needed:
$ lando stop
Step 10: Modify PHP Version
Edit your .lando.yml
file to set the PHP version to 7.4 under the config section.
Step 11: Restart Lando with PHP 7.4
Restart Lando to apply the changes:
$ lando start
Step 12: Verify PHP Version
Access your Lando environment and check the PHP version:
$ lando ssh
$ php --version
Step 13: Rebuild Lando
If needed, rebuild your Lando environment:
$ lando rebuild
Step 14: Verify PHP Version Again
After rebuilding, check the PHP version once more:
$ lando ssh
$ php --version
Summary:
Congratulations! You've successfully set up a Drupal 10 project using Lando, managing PHP versions seamlessly. Remember, these steps provide a foundation for your local development environment, allowing you to efficiently work on your Drupal projects.
Top comments (0)