special sponsors

How do I configure a Lando Recipe?

Written by: Team Lando Team Lando
Guide Tested: Yes

When you first initialize a lando app (lando init) you get a very simple .lando.yml configuration file. Here is the .lando.yml file for the LAMP recipe.

name: mylamp
recipe: lamp
config:
  webroot: .

By using the config key in the lando.yml file you can configure aspects of your app to say match the production instance. For example say your production server is using PHP 5.6; you can set that under the config key like so:

name: mylamp
recipe: lamp
config:
  webroot: .
  php: 5.6

Now be sure to rebuild your app so that the new changes take effect:

lando rebuild -y

You can check that the change took by using lando php -v:

└─ $ ∴ lando php -v
PHP 5.6.40 (cli) (built: Jan 23 2019 00:10:05) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Similarly you can pin down the database backend and version of your app. Say you want MariaDB 10.3:

name: mylamp
recipe: lamp
config:
  webroot: .
  php: 5.6
  database: mariadb:10.3

Again rebuild for the changes: lando rebuild -y and 💥 you now have PHP 5.6 and MariaDB 10.3!

Have a Lando question you'd like to see as a guide? Suggest one!
Want to write a Lando guide? Learn how!