If you’ve worked on web development on your computer or laptop, you’ve probably used some kind of local development environment. Over the years, I’ve used some different applications or platforms for this.
Being a Mac user for the past several years, I’ve used MAMP.
One online development course I took went through the steps to set up XAMPP, and I used that a few times.
When I started working for an agency, the team used WAMP.
Then they switched to Vagrant, then to VVV, then it was left up to us what we wanted to use.
An advanced WordPress meetup discussed the merits of several platforms, such as ones I’ve previously mentioned, but also Lando and Local by Flywheel. They all have their pros and cons, but I’ve continued working with Lando for the past couple of years. Once I got my process down with Lando, it’s worked well for me.
My Lando sites are set up in their own directory. Every time I need to create a new site to work on, it’s a simple matter to create a new folder and get started with local development. Being a WordPress developer, I utilize the same recipe for most of my work. If it happens that you need a different setup, there’s a good chance that Lando has a recipe for it.
Download Lando and install it on your machine
brew install --cask lando
Linux users will need to download and install Docker, then do the same with Lando.
Use a WordPress Recipe for Lando
After some experimentation and research with different Lando recipes, I’ve settled on this one as my go-to for development.
There are more configurations that you can include in the recipe if you want, but this one works for me. It sets up the mySQL database and provides me with an phpMyAdmin link when I start up the environment.
If you haven’t worked with YAML before, it can be very picky about how the text is spaced and won’t work if the line spacing is off with child elements.
name: starter recipe: wordpress config: php: '7.4' webroot: . database: 'mysql:5.7' xdebug: true services: pma: type: phpmyadmin hosts: - database proxy: appserver: - starter.lndo.site pma: - pma.starter.lndo.site
When setting up a new Lando site now, I usually get WordPress installed and the database credentials into the wp-config file before starting it up. When I first worked with Lando I would start the local server up just to check if it was working before doing anything else.
You’ll notice that Lando gives you a list of the urls available to you for the site. There is a separate list at the bottom for the phpMyAdmin urls.
If you click on one of the links listed under Appserver URLs, the site will open in your browser. Let’s take a look:
So . . . this doesn’t look very exciting. It’s a directory listing with no files.
But it does show that the local site is up and running.
If you click on the link for phpMyAdmin, you’ll see the database has been created for the WordPress installation, but it doesn’t have any tables yet.
Let’s install WordPress.
You can download a zip file from wordpress.org and install it manually.
You can also choose to use WP-CLI, if you have that set up on your machine. In your terminal, git bash, or whatever you use for command line, navigate to your root directory. Then run the following command:
wp core download
After the download has completed, run the command to install the core:
wp core install
Set the database credentials
Once you have WordPress downloaded and installed to your local dev folder, create a wp-config.php file. If you’re doing this manually, just make a copy of wp-config-sample.php and edit it to add the database credentials. Otherwise, WP-CLI has a wp config create command that will help you do this, along with checking that the credentials work.
With Lando, the database credentials will be as follows:
database name: wordpress
database username: wordpress
database password: wordpress
database host: database
Once you have the database connection set, you can go to the front end of the site and complete the WordPress setup.
Once you go through the steps to complete the WordPress setup, you can go ahead and start developing!
When you want to shut down your Lando environment, type in ‘lando stop’ to stop your current app, and ‘lando poweroff’ to spin down any active containers.
Find a more complete list of Lando commands here.