Skip to main content
Wecode uses environment variables to configure application settings. All environment variables are defined in the .env file in the root directory.

Initial Setup

Copy the example environment file to create your configuration:
cp .env.example .env
After copying, generate an application key:
php artisan key:generate

Application Settings

APP_NAME

The name of your application, used in notifications and UI elements.
APP_NAME=Laravel
Default: Laravel

APP_ENV

The application environment. Determines how services are configured.
APP_ENV=local
Options:
  • local - Development environment
  • staging - Staging environment
  • production - Production environment
Default: production

APP_DEBUG

Enables detailed error messages with stack traces.
APP_DEBUG=true
Never enable debug mode in production. This exposes sensitive information about your application structure and configuration.
Options:
  • true - Show detailed error messages
  • false - Show generic error pages
Default: false

APP_KEY

Encryption key used by Laravel’s encryption services. Must be a random 32-character string.
APP_KEY=
The APP_KEY is critical for security. Generate it using php artisan key:generate and never share it publicly.

APP_URL

The base URL of your application. Used for generating URLs in emails and commands.
APP_URL=http://localhost
Example: https://wecode.example.com

APP_ARCHIVED

Indicates whether the application is in archived mode.
APP_ARCHIVED=false
Options:
  • true - Application is archived
  • false - Application is active
Default: false

Database Configuration

DB_CONNECTION

The database driver to use.
DB_CONNECTION=mysql
Supported drivers:
  • mysql - MySQL/MariaDB
  • pgsql - PostgreSQL
  • sqlite - SQLite
  • sqlsrv - SQL Server
Default: mysql

DB_HOST

The database server hostname or IP address.
DB_HOST=127.0.0.1
Default: 127.0.0.1

DB_PORT

The database server port.
DB_PORT=3306
Default ports:
  • MySQL: 3306
  • PostgreSQL: 5432
  • SQL Server: 1433

DB_DATABASE

The name of the database to connect to.
DB_DATABASE=wecode
Default: wecode

DB_USERNAME

The database username.
DB_USERNAME=homestead
Default: homestead

DB_PASSWORD

The database password.
DB_PASSWORD=secret
Use a strong password for production databases and never commit your .env file to version control.
Default: secret

Mail Configuration

MAILER_DSN

The mail server connection string using DSN format.
MAILER_DSN=smtp://email%40gmail.com:[email protected]:587
Format: smtp://username:password@host:port Note: URL-encode special characters in the username and password (e.g., @ becomes %40). Example configurations:
MAILER_DSN=smtp://your-email%40gmail.com:[email protected]:587

Cache Settings

CACHE_DRIVER

The cache storage driver.
CACHE_DRIVER=file
Supported drivers:
  • file - File-based cache
  • database - Database cache
  • redis - Redis cache
  • memcached - Memcached cache
  • apc - APC cache
  • array - Array cache (testing only)
Default: file

Session Settings

SESSION_DRIVER

The session storage driver.
SESSION_DRIVER=file
Supported drivers:
  • file - File-based sessions
  • cookie - Cookie-based sessions
  • database - Database sessions
  • redis - Redis sessions
  • memcached - Memcached sessions
  • array - Array sessions (testing only)
Default: file

SESSION_LIFETIME

Session lifetime in minutes.
SESSION_LIFETIME=120
Default: 120 (2 hours)

Queue Configuration

QUEUE_CONNECTION

The queue driver for background jobs.
QUEUE_CONNECTION=sync
Supported drivers:
  • sync - Synchronous (no queue)
  • database - Database queue
  • redis - Redis queue
  • sqs - Amazon SQS
Default: sync

Redis Configuration

REDIS_HOST

Redis server hostname.
REDIS_HOST=127.0.0.1
Default: 127.0.0.1

REDIS_PASSWORD

Redis server password (if required).
REDIS_PASSWORD=null
Default: null

REDIS_PORT

Redis server port.
REDIS_PORT=6379
Default: 6379

Logging

LOG_CHANNEL

The logging channel to use.
LOG_CHANNEL=stack
Default: stack

Broadcasting

BROADCAST_DRIVER

The broadcast driver for real-time events.
BROADCAST_DRIVER=log
Supported drivers:
  • log - Log broadcasts (development)
  • pusher - Pusher service
  • redis - Redis broadcasting
  • null - Disable broadcasting
Default: log

AWS Configuration

Optional settings for AWS services (S3, SES, etc.).
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

Pusher Configuration

Optional settings for Pusher real-time broadcasting.
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

Production Checklist

Before deploying to production, verify these settings:
  • APP_ENV is set to production
  • APP_DEBUG is set to false
  • APP_KEY is generated and kept secure
  • APP_URL matches your production domain
  • Database credentials are secure
  • Mail configuration is properly tested
  • .env file is not committed to version control
  • File permissions are properly set (.env should be readable only by the web server)

Build docs developers (and LLMs) love