Environment Variables

The basic database settings for UserFrosting can be set through environment variables. By default, UserFrosting looks for the following environment variables:

Variable Description
UF_MODE The current environment Modes
DB_DRIVER The database driver to use (choice of mysql, pgsql, sqlite or sqlsrv)
DB_HOST The database host (ie.: localhost)
DB_PORT The database port
DB_NAME The name of the database to use for this install
DB_USER The database user account
DB_PASSWORD The database user password
SMTP_HOST SMTP server host used to send emails
SMTP_USER SMTP server user used to send emails
SMTP_PASSWORD SMTP server user password used to send emails

If you don't want to (or can't) configure environment variables directly in your development environment, UserFrosting uses the fantastic phpdotenv library to let you set these variables in a .env file. When running the bake installer, this file will be created for you. To make any modifications, your can run the following Bakery command:

$ php bakery setup

You can also edit the .env file manually. Simply copy the sample file in your app/ directory:

$ cp app/.env.example app/.env

Now, you can set values in the .env file and UserFrosting will pick them up as if they were actual environment variables.

You may also want to configure your SMTP server settings as well at this point so that you can use features that require mail, such as password reset and email verification. See Chapter 14 for more information on the mail service.