Introduction
Laravel Forge makes it easy to manage environment variables for your sites. If your project contains a.env
file, you can easily create and edit environment variables from the “Environment” tab of your site’s settings.
If Laravel Forge detects a
.env.example
file in your project, it will automatically copy this and replace some of the settings to match your server’s database settings during site creation.An empty .env.example
file could result in an empty environment file on the first deployment of your site.Encrypted environment files
Laravel Forge provides support for Laravel’s encrypted environment files without requiring you to include your encryption key within your deployment script. To leverage this feature, add your encryption key to the “Encrypted environment files” section of your site’s “Environment” tab. Once added, Laravel Forge will inject the value into theLARAVEL_ENV_ENCRYPTION_KEY
environment variable during deployments, allowing you to add the env:decrypt
Artisan command to your deployment script without needing to specify the --key
option manually.