Skip to main content
Proper configuration is essential for running VIP2CARS. This guide covers all environment settings and database configuration.

Environment File Setup

Creating the .env File

VIP2CARS uses a .env file for environment-specific configuration.
1

Copy the example file

cp .env.example .env
2

Generate application key

php artisan key:generate
This creates a secure encryption key for your application.
3

Edit configuration

Open .env in your text editor and configure the settings below.

Application Settings

Basic Configuration

APP_NAME=VIP2CARS
APP_ENV=production
APP_KEY=base64:your-generated-key-here
APP_DEBUG=false
APP_URL=https://yourdomain.com
The name of your application. This is used in emails, notifications, and the UI.Default: Laravel
Recommended: VIP2CARS
The application environment.Options: local, staging, production
Development: local
Production: production
Encryption key for securing session data and encrypted values.
Never share your APP_KEY. Generate a new one using php artisan key:generate.
Enables detailed error messages.Development: true
Production: false
Always set to false in production to prevent sensitive information leakage.
The base URL of your application.Development: http://localhost:8000
Production: https://yourdomain.com

Localization Settings

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
  • APP_LOCALE: Default language for the application
  • APP_FALLBACK_LOCALE: Fallback language if translation is missing
  • APP_FAKER_LOCALE: Locale for generating fake data in seeders

Security Settings

BCRYPT_ROUNDS=12
The number of hashing rounds for password encryption. Higher values are more secure but slower.
Default value of 12 provides a good balance between security and performance.

Database Configuration

For production environments, configure MySQL/MariaDB:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=vip2cars
DB_USERNAME=root
DB_PASSWORD=your-secure-password
1

Create the database

CREATE DATABASE vip2cars CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
2

Create database user (recommended)

CREATE USER 'vip2cars_user'@'localhost' IDENTIFIED BY 'secure-password';
GRANT ALL PRIVILEGES ON vip2cars.* TO 'vip2cars_user'@'localhost';
FLUSH PRIVILEGES;
3

Update .env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=vip2cars
DB_USERNAME=vip2cars_user
DB_PASSWORD=secure-password

SQLite Database (Development)

For local development, SQLite is pre-configured:
DB_CONNECTION=sqlite
With SQLite, you don’t need to specify host, port, username, or password. The database file is stored at database/database.sqlite.

Additional Database Options

DB_CHARSET=utf8mb4
DB_COLLATION=utf8mb4_unicode_ci
These are automatically set for MySQL connections and ensure proper Unicode support.
DB_SOCKET=/var/run/mysqld/mysqld.sock
Optional: Use Unix socket instead of TCP connection for local databases.

Session Configuration

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
Options: file, cookie, database, redisDefault: database - Sessions are stored in the database.
For production with multiple servers, use redis or database for session persistence.
Session lifetime in minutes.Default: 120 (2 hours)

Cache Configuration

CACHE_STORE=database
Available drivers:
  • file - File-based cache (default for development)
  • database - Database cache (default)
  • redis - Redis cache (recommended for production)
  • memcached - Memcached cache
For production environments, consider using Redis for better performance.

Queue Configuration

QUEUE_CONNECTION=database
Available drivers:
  • sync - Synchronous (no queue)
  • database - Database queue (default)
  • redis - Redis queue (recommended for production)
In production, use database or redis and run php artisan queue:work as a background process.

Mail Configuration

Development (Log)

MAIL_MAILER=log
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
During development, emails are written to storage/logs/laravel.log.

Production (SMTP)

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=your-username
MAIL_PASSWORD=your-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

Redis Configuration (Optional)

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
Redis is optional but recommended for production caching and queues.

Logging Configuration

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

Production Logging

LOG_CHANNEL=stack
LOG_STACK=daily
LOG_LEVEL=error
Log levels (from least to most severe):
  • debug - Detailed debug information
  • info - Informational messages
  • notice - Normal but significant events
  • warning - Warning messages
  • error - Error messages
  • critical - Critical conditions
  • alert - Action must be taken immediately
  • emergency - System is unusable

Storage Configuration

FILESYSTEM_DISK=local
Available disks:
  • local - Local storage in storage/app
  • public - Public storage in storage/app/public
  • s3 - Amazon S3 (requires AWS configuration)

AWS S3 Configuration (Optional)

AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your-bucket-name
AWS_USE_PATH_STYLE_ENDPOINT=false

Vite Configuration

VITE_APP_NAME="${APP_NAME}"
This makes the app name available to your frontend JavaScript code.

Maintenance Mode

APP_MAINTENANCE_DRIVER=file
Controls how maintenance mode state is stored.
Enable maintenance mode with php artisan down and disable with php artisan up.

Configuration Caching

After modifying your .env file in production:
1

Clear configuration cache

php artisan config:clear
2

Cache configuration

php artisan config:cache
When configuration is cached, the .env file is not read. Always clear and recache after changes.

Verification

Test your database connection:
php artisan tinker
Then run:
DB::connection()->getPdo();
If successful, you’ll see PDO connection details.

Next Steps

With your environment configured, proceed to Production Deployment to prepare your application for production.

Build docs developers (and LLMs) love