.env.laravel
BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120
: This is a template file. It contains the exact same keys as your .env file, but the values are left blank or filled with placeholder text. This file is committed to version control. It serves as a blueprint for other developers or deployment pipelines to know which environment variables the application requires to run. 3. Anatomy of a Laravel .env File
If you need specific environment files for different deployment stages, Laravel supports: .env.staging .env.production .env.testing .env.laravel
APP_NAME="My Laravel Application"
APP_NAME=Laravel APP_ENV=local APP_KEY=base64:your_generated_key_here APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=stack LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD= BROADCAST_CONNECTION=log CACHE_STORE=database FILESYSTEM_DISK=local QUEUE_CONNECTION=sync SESSION_DRIVER=database SESSION_LIFETIME=120 MEMCACHED_HOST=127.0.0.1 REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_MAILER=smtp MAIL_HOST=mailpit MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_NAME="$APP_NAME" AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_HOST= PUSHER_PORT=443 PUSHER_SCHEME=https PUSHER_APP_CLUSTER=mt1 VITE_APP_NAME="$APP_NAME" VITE_PUSHER_APP_KEY="$PUSHER_APP_KEY" VITE_PUSHER_APP_HOST="$PUSHER_HOST" VITE_PUSHER_APP_SCHEME="$PUSHER_SCHEME" VITE_PUSHER_APP_CLUSTER="$PUSHER_APP_CLUSTER" Use code with caution. 2. .env vs. .env.example It serves as a blueprint for other developers
While Laravel natively uses a file named simply .env , the concept of often emerges in discussions about deployment strategies, version control, and multi-environment setups. In this article, we’ll demystify the .env mechanism in Laravel, explore the rationale behind naming conventions like .env.laravel , and provide a battle-tested guide to managing your configuration securely across local, staging, and production environments.
Demystifying the .env File in Laravel: A Comprehensive Guide In this article
✅ by running php artisan config:cache .
// config/features.php return [ 'new_dashboard' => env('ENABLE_NEW_DASHBOARD', false), 'promo_expiry' => (int) env('PROMO_CODE_EXPIRY_DAYS', 7), ]; Use code with caution. Copied to clipboard 3. Use the Feature in Your Code
This flexibility is useful for multi-tenant applications or when you need to switch configurations without touching the filesystem.
Application configuration in file or in database? - Laracasts