Use Lando for local development
Back to home
On this page
Lando is a third-party local development tool for which several stacks are available (LAMP, LEMP, MEAN). Lando works with most services supported by Platform.sh except for Vault KMS and network storage. See a list of supported services.
Note
Lando used to support Platform.sh PHP projects out of the box through a plugin. However, this plugin is now deprecated. It’s still available, but it’s no longer receiving updates and isn’t guaranteed to work.
For a seamless experience, switch to DDEV, which is the recommended tool for local development with Platform.sh. The integration with DDEV is maintained by Platform.sh to ensure it works smoothly. Note that a Platform.sh migration guide from Lando to DDEV will be released soon.
For a complete reference, consult the following resources:
Before you begin
You need :
- Hardware that meets the requirements.
- A PHP project.
Lando doesn’t automatically pull and set up environment variables that have been set in the Console. To use a build hook that requires environment variables, manually add them.
1. Install Lando
Follow the Lando installation instructions.
2. Create an access token
To authorize Lando to communicate with Platform.sh, create an API token. Copy the value.
3. Initialize Lando
If your code isn’t present locally, retrieve your codebase with one of these methods:
- Using the Platform.sh CLI by running
platform get PROJECT_ID
- Using Git
Otherwise, access the directory with your project.
Run lando init –recipe platformsh –source cwd –platformsh-auth API_TOKEN
and follow the instructions provided by the interactive prompt.
Note
If for some reason you get an error using the Platform.sh recipe, be sure to install the latest version of the Platform.sh plugin and run the command again.
For a quicker start, create a project based on the Platform.sh PHP template. The template provides the most basic configuration for running a custom PHP project built with Composer. It also includes the required Platform.sh configuration files out of the box.
- Create a new project based on the PHP template.
- Clone that project locally in one of these ways:
- Using the Platform.sh CLI by running
platform get PROJECT_ID
. - Using Git
- Using the Platform.sh CLI by running
- In the project’s folder, run
lando init –recipe platformsh –source platformsh –platformsh-auth API_TOKEN
. - Follow the instructions provided by the interactive prompt.
On the
Which project?
step, select the project created in the first step.
The init
command generates the .lando.yml
file required to start Lando.
It also adds to your account a public SSH key.
4. Start Lando
To start your app and services, run lando start
.
5. Access your local app
The last lines of the lando start
command from the previous step contains URL to the different app and services.
Access your app and services by opening the according URLs in your browser.
What’s next
- Import data and download files from your remote Platform.sh site.
- If you make changes in the Platform.sh configuration files during development, run
lando rebuild
for these to be taken into account in Lando. - To keep your Lando image up-to-date, see how to update Lando.
Troubleshooting
Note
Lando used to support Platform.sh PHP projects out of the box through a plugin. However, this plugin is now deprecated. It’s still available, but it’s no longer receiving updates and isn’t guaranteed to work.
For a seamless experience, switch to DDEV, which is the recommended tool for local development with Platform.sh. The integration with DDEV is maintained by Platform.sh to ensure it works smoothly. Note that a Platform.sh migration guide from Lando to DDEV will be released soon.
- Make sure that the Platform.sh configuration files are present in your local repository.
- Check that your services are supported by Lando.
- Check caveats and known issues.
- Carefully check the output of the Lando commands you run to spot warnings and errors.
- Run
lando rebuild
. - Restart Lando in debug mode by running
lando restart -vvv
. - Check that you don’t face common issues, such as DNS rebinding protection.
- For more extensive troubleshooting, check the Lando documentation.
Access logs
Access the global logs by running lando logs
.
To access specific logs:
- Run
lando list
to get a list of the services you are using. - Choose the one you’d like to inspect.
- Run
lando logs -s SERVICE_TO_INSPECT
.
For more guidance regarding logs, check the Lando logs documentation
Untrusted SSL certificate
When you access your local Lando sites through HTTPS, you get an error message in your browser. This is expected behavior.
Find out how to solve it in the Lando blog.