.env file at the root of your project.
Getting Started
Copy the example environment file to create your own:Environment Variables
Application Settings
Application Settings
APP_NAME
Default:LaravelThe name of your application. Used in email notifications and other user-facing messages.APP_ENV
Default:localThe application environment. Common values:local- Development environmentstaging- Staging environmentproduction- Production environment
APP_KEY
Default: Empty (must be generated)The application encryption key. This is used for encrypting session data, cookies, and other sensitive information.Generate this key using
php artisan key:generate during setup.APP_DEBUG
Default:trueEnables or disables debug mode. When enabled, detailed error messages are displayed.APP_URL
Default:http://localhostThe base URL of your application. Used for generating links and URLs.APP_LOCALE
Default:enThe default locale for your application.APP_FALLBACK_LOCALE
Default:enThe fallback locale when a translation is not available in the current locale.APP_FAKER_LOCALE
Default:en_USThe locale used by Faker for generating fake data in tests and seeders.APP_MAINTENANCE_DRIVER
Default:fileThe driver for storing maintenance mode state. Options: file, cache.BCRYPT_ROUNDS
Default:12The number of rounds to use for bcrypt hashing. Higher values increase security but require more processing time.Database Configuration
Database Configuration
DB_CONNECTION
Default:sqliteThe default database connection. Supported values: sqlite, mysql, mariadb, pgsql, sqlsrv.The default SQLite connection works out of the box without additional configuration.
MySQL/PostgreSQL Configuration
These variables are commented out by default when using SQLite. Uncomment and configure them when switching to MySQL or PostgreSQL:Caching & Sessions
Caching & Sessions
CACHE_STORE
Default:databaseThe cache driver to use. Options: database, file, memcached, redis, array.CACHE_PREFIX
Default: EmptyA prefix for cache keys to avoid collisions with other applications.SESSION_DRIVER
Default:databaseThe session storage driver. Options: file, cookie, database, memcached, redis, array.SESSION_LIFETIME
Default:120Session lifetime in minutes.SESSION_ENCRYPT
Default:falseWhether to encrypt session data.SESSION_PATH
Default:/The session cookie path.SESSION_DOMAIN
Default:nullThe session cookie domain.Queue & Job Processing
Queue & Job Processing
QUEUE_CONNECTION
Default:databaseThe queue driver to use. Options: sync, database, redis, sqs, beanstalkd.Logging
Logging
LOG_CHANNEL
Default:stackThe default log channel. Options: stack, single, daily, slack, syslog, errorlog.LOG_STACK
Default:singleThe channels to include when using the stack channel.LOG_DEPRECATIONS_CHANNEL
Default:nullThe channel for deprecation warnings.LOG_LEVEL
Default:debugThe minimum log level. Options: debug, info, notice, warning, error, critical, alert, emergency.Mail Configuration
Mail Configuration
MAIL_MAILER
Default:logThe mail driver to use. Options: smtp, sendmail, mailgun, ses, postmark, log, array.The
log driver writes emails to the log file instead of sending them. Perfect for local development.MAIL_HOST
Default:127.0.0.1The SMTP server hostname.MAIL_PORT
Default:2525The SMTP server port.MAIL_USERNAME
Default:nullThe SMTP username for authentication.MAIL_PASSWORD
Default:nullThe SMTP password for authentication.MAIL_ENCRYPTION
Default: Not setThe encryption method. Options:tls, ssl, or leave empty for no encryption.MAIL_FROM_ADDRESS
Default:[email protected]The default sender email address.MAIL_FROM_NAME
Default:${APP_NAME}The default sender name. Uses the APP_NAME value by default.Redis Configuration
Redis Configuration
Broadcasting & Filesystem
Broadcasting & Filesystem
AWS Configuration
AWS Configuration
Used for S3 file storage, SES email, and other AWS services.AWS_ACCESS_KEY_ID: Your AWS access keyAWS_SECRET_ACCESS_KEY: Your AWS secret keyAWS_DEFAULT_REGION: AWS region (e.g.,
us-east-1, eu-west-1)AWS_BUCKET: S3 bucket nameAWS_USE_PATH_STYLE_ENDPOINT: Use path-style endpoint for S3 (for MinIO compatibility)Development Tools
Development Tools
Environment-Specific Configuration
Security Best Practices
- Always generate a unique
APP_KEYfor each environment - Set
APP_DEBUG=falsein production - Set
APP_ENV=productionin production - Use strong database passwords
- Keep your
.envfile permissions restricted (readable only by the application user) - Use environment-specific values for sensitive data
- Consider using a secrets management service for production environments
Accessing Environment Variables
In your code, access environment variables using theenv() helper: