To contribute to this documentation, please submit a pull request to our learn repository.
Lando provides a stable, easy-to-use, and portable local development environment. It allows you to integrate phpMyAdmin (among other services) and simplifies setting up XDebug.
Note: Lando is not meant for production!
Start by installing Lando.
Next, create your Lando configuraton file in your application root. Call the file .lando.yml. A sample configuration is provided below:
name: userfrosting
recipe: lamp
config:
webroot: ./public
php: '7.3'
database: mariadb
xdebug: true
services:
appserver:
build_as_root:
- apt-get update -y
- apt-get install -my wget gnupg
- a2enmod headers
# Patch to bring NodeJS into app server container
# https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html
- curl -sL https://deb.nodesource.com/setup_12.x | bash -
- apt-get install -y nodejs
overrides:
environment:
PHP_IDE_CONFIG: "serverName=userfrosting.lndo.site"
ssl: true
# Redis cache
cache:
type: redis
# Add phpMyAdmin database web client
pma:
type: phpmyadmin
hosts:
- database
proxy:
pma:
- pma.userfrosting.lndo.site
tooling:
phpunit:
service: appserver
description: "Run PHP Unit tests"
cmd: app/vendor/bin/phpunit
redis-cli:
service: cache
description: "Redis cache CLI"
bakery:
service: appserver
description: "UserFrosting CLI"
cmd: php bakery
This configuration file creates a LAMP stack.
If you prefer a LEMP (nginx) stack, change "lamp" to "lemp" in the recipe setting near the top of the file and be sure to comment out the a2enmod headers line in the build section for the Lando config file.
app/sprinkles.example.json to app/sprinkles.jsonchmod 777 app/{logs,cache,sessions} to fix file permissions for web server. (NOTE: File
permissions should be properly secured in a production environment!)Using the terminal, run lando start from within your UserFrosting app. The first start up will take a brief period to install everything and set up the docker components.
When the application boots successfully, you'll see something like:
___ __ __ __ __ ______
/ _ )___ ___ __ _ ___ / / ___ _/ /_____ _/ /__ _/ /_____ _/ / / /
/ _ / _ \/ _ \/ ' \(_-</ _ \/ _ `/ '_/ _ `/ / _ `/ '_/ _ `/_/_/_/
/____/\___/\___/_/_/_/___/_//_/\_,_/_/\_\\_,_/_/\_,_/_/\_\\_,_(_|_|_)
Your app has started up correctly.
Here are some vitals:
NAME userfrosting
LOCATION /home/silicon/source/uf/framework
SERVICES appserver, database, cache, pma
APPSERVER URLS https://localhost:32895
http://localhost:32896
http://userfrosting.lndo.site/
https://userfrosting.lndo.site/
PMA URLS http://localhost:32898
http://pma.userfrosting.lndo.site/
Next, we need to install UserFrosting.
lando composer install to install UserFrosting's PHP dependencies.lando bakery bake to run UserFrosting's bake command and follow the UserFrosting install steps as described in the previous chapter.In your app/.env file, use the following constants to get you started. If you changed to a LEMP stack, replace "lamp" with "lemp" below.
DB_DRIVER="mysql"
DB_HOST="database"
DB_PORT="3306"
DB_NAME="lamp"
DB_USER="lamp"
DB_PASSWORD="lamp"
Having database connection troubles? Get database connection details and more by running
lando info
lando stoplando startlando infolando destroyNow that you have your application running, you can access it at http://userfrosting.lndo.site. Lando supports SSL as well, but if you get SSL certificate errors follow the guidance listed at Lando Security.
Additional tooling and services can be accessed via;
lando bakerylando phpunit and lando bakery testlando redis-cliIf using Lando in WSL 2 via the Docker for Windows WSL 2 backend you may experience difficulties connecting to XDebug. The cause may be the XDebug port (
9000by default) not being forwarded to Windows, assuming an XDebug misconfiguration has not already been ruled out. microsoft/WSL#4636 is a good place to start looking for potential workarounds and fixes if impacted.
To use PHPStorm's built in xdebug support to enable breakpoints and other useful debug tools, you'll want to add your Lando server to PHPStorm.
cmd+x on Mac)userfrosting.lndo.site userfrosting.lndo.site. 80 as the port.Xdebug as the debugger/app and save your changes