I’ve been increasingly using Lando on projects and am really pleased with it. However, where DDev already has a plugin for BLT thanks to the incredible Lindsey Catlett (see her plugin here) we don’t have the same thing for Lando. So I wrote one.
This is a very very basic plugin, but it does the job.
What does it do?
Basically, the plugin provides an automatically generated .lando.yml file you AND it automatically fills in a few of the details using the blt.yml file. That’s all, not fancy. BUT it is essentially a pre-configured lando config designed to “work” with BLT. A few specific callouts:
Node is installed inside the application container. YES this is a deviation from docker containerization best practices. However, npm and other frontend dependencies are commonly needed for BLT projects so it’s important to have it installed on this container.
Chrome is installed and setup to work “properly.” Again, this is a bit of a deviation from docker strategy (in that you might want a separate container for this) but we need the webserver to be able to talk to itself, so it’s here!
Rapidly toggles xdebug on/off. Xdebug is both our savior and our curse, depending on what we’re doing (and when). As I’ve discussed in my post on IDEs, XDebug is a critical part of development. HOWEVER it also has a massive performance impact on sites. So sometimes it’s quite important to turn it off. So my lando config does so! Simple lando xdebug-on or lando xdebug-off to enable/disable.
Fixes SSH keys. There is a known issue that’s been open on the Lando forums since 2017 related to SSH key forwarding and passphrases. TLDR you sometimes have to enter your passphrase in lando every time you try and use an SSH key. That’s a pain in the butt. So I implemented marji’s recommended ssh-fix command and it works GREAT. Simply ssh-add on your host machine and enter your passphrase, then run lando ssh-fix and it will forward the key properly into the VM.
How do you use it?
The first thing is to add the plugin to your project.
composer require mikemadison13/blt-lando
Once composer has resolved, you can run the new BLT recipe. Make sure you’ve configured your hostname and machine name in blt.yml before running this step!
blt recipes:vm:lando
The recipe will copy a pre-configured .lando.yml file into your project root and replace certain keys for the project into the lando file.
Carefully review the .lando.yml file to ensure your proper version of PHP is included, etc. Then you just need to start it up with:
lando start
Last Thoughts
BLT provides a really robust plugin ecosystem thanks to Robo. I’ve been writing more of them and I would encourage you to do so as well. Why? Well, because there are a lot of folks that would benefit from common code. Lindsey’s DDev plugin is amazing and it is widely used. I hope that this gets some traffic as well!
I just got a new work Laptop about a week ago. This post is about my experience during this first week using the new computer!