Configuration

Here are the configuration options, set to the default values, for this recipe. If you are unsure about where this goes or what this means we highly recommend scanning the recipes documentation to get a good handle on how the magicks work.

Choosing a php version

You can set php to any version that is available in our php service. However, you should consult the Laravel requirements to make sure that version is actually supported by Laravel itself.

Here is the recipe config to set the Laravel recipe to use php version 7.1

recipe: laravel
config: php:'7.1'

Choosing a webserver

By default this recipe will be served by the default version of our apache service but you can also switch this to use nginx. We highly recommend you check out both the apache and nginx services before you change the default via.

With Apache (default)

recipe: laravel
config: via: apache

With nginx

recipe: laravel
config: via: nginx

Choosing a database backend

By default this recipe will use the default version of our mysql service as the database backend but you can also switch this to use mariadb or 'postgres' instead. Note that you can also specify a version as long as it is a version available for use with lando for either mysql, mariadb or postgres.

If you are unsure about how to configure the database we highly recommend you check out the mysql, mariadband 'postgres' services before you change the default.

Also note that like the configuration of the php version you should consult the Laravel requirements to make sure the database and version you select is actually supported by Laravel itself.

Using MySQL (default)

recipe: laravel
config: database: mysql

Using MariaDB

recipe: laravel
config: database: mariadb

Using Postgres

recipe: laravel
config: database: postgres

Using a custom version

recipe: laravel
config: database: postgres:9.6

Choosing a caching backend

By default this recipe will not spin up a caching backend.

However, you can specify one using the cache recipe config and setting it to use either our use redis or memcached service. Note that you can optionally/additionally specify a particular version for either as long as it is a version documented as available for use with lando for either service.

If you are unsure about how to configure the cache we highly recommend you check out our redis and memcached) docs as well as the Laravel ones.

Using redis (recommended)

recipe: laravel
config: cache: redis

Using Memcached

recipe: laravel
config: cache: memcached

Using a custom version

recipe: laravel
config: cache: redis:2.8

Using xdebug

This is just a passthrough option to the xdebug setting that exists on all our php services. The tl;dr is xdebug: true enables and configures the php xdebug extension and xdebug: false disables it.

Using custom config files

If you do this you must use files that exists inside your applicaton and express them relative to your project root as below.

Note that the default files may change based on how you set both ssl and via. Also note that the vhosts and server config will be either for apache or nginx depending on how you set via. We highly recommend you check out both the apache and nginx if you plan to use a custom vhosts or server config.

A hypothetical project

Note that you can put your configuration files anywhere inside your application directory. We use a config directory in the below example but you can call it whatever you want such as .lando.

Environment File

By default, Laravel comes with a .env configuration file set to use homestead. You will want to modify the following .env key so that it makes sense for use with Lando.

Here is what that file would look like if you installed laravel as above. Note that your file might be slightly different depending on your configuration.

APP_NAME=Laravel
APP_ENV=local
APP_DEBUG=true
APP_URL=http://my-first-laravel-app.lndo.site
LOG_CHANNEL=stack
# If you set `database: mysql|mariadb` in this recipes config
DB_CONNECTION=mysql
DB_HOST=database
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=laravel
# If you set `database: postgres` in this recipes config# DB_CONNECTION=pgsql# DB_HOST=database# DB_PORT=5432# DB_DATABASE=laravel# DB_USERNAME=postgres# DB_PASSWORD=null
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
# If you have `cache: redis` in this recipes config# REDIS_HOST=cache# REDIS_PASSWORD=null# REDIS_PORT=6379# If you added a mailhog service to this recipe# MAIL_DRIVER=smtp# MAIL_HOST=sendmailhog# MAIL_PORT=1025# MAIL_USERNAME=null# MAIL_PASSWORD=null# MAIL_ENCRYPTION=null

Connecting to your database and/or cache

Lando will automatically set up a database with a user and password and also set an environment variables called LANDO INFO that contains useful information about how your application can access other Lando services.

Here are is the default database connection information for a Laravel site. Note that the host is not localhost but database.

If you've also specified a caching backend here are the default connection settings.

host: cache
# Redisport:6379# Memcacheport:11211

You can get also get the above information, and more, by using the lando info command.

Importing Your Database

Once you've started up your Laravel site you will need to pull in your database and files before you can really start to dev all the dev. Pulling your files is as easy as downloading an archive and extracting it to the correct location. Importing a database can be done using our helpful lando db-import command.

You can also run lando from inside your app directory for a complete list of commands which is always advisable as your list of commands may not 100% be the same as the above. For example if you set database: postgres you will get lando psql instead of lando mysql.