Skip to main content

Environment configuration

LaraCMS uses a .env file to store environment-specific configuration. This file is created from .env.example during installation and should never be committed to version control.
Never commit your .env file to version control. It contains sensitive information like API keys and database credentials.

Application settings

Basic configuration

These are the fundamental settings for your LaraCMS installation:
.env
APP_NAME="LaraCMS"
APP_ENV=local
APP_KEY=base64:your-generated-key
APP_DEBUG=true
APP_URL=http://localhost:8000
APP_NAME
string
default:"Laravel"
The name of your application, displayed in emails and the admin interface
APP_ENV
string
default:"local"
The environment your application is running in: local, staging, or production
APP_KEY
string
required
Application encryption key. Generate with php artisan key:generate
APP_DEBUG
boolean
default:"true"
Enable detailed error messages. Set to false in production
APP_URL
string
required
The base URL of your application. Used for generating links and sitemaps

Localization

.env
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_LOCALE
string
default:"en"
Default language for your application
APP_FALLBACK_LOCALE
string
default:"en"
Fallback language when translations are missing
APP_FAKER_LOCALE
string
default:"en_US"
Locale for generating fake data in development and testing

Database configuration

LaraCMS supports multiple database systems. Choose the one that best fits your needs.
SQLite is the default database, perfect for development and small deployments:
.env
DB_CONNECTION=sqlite
When using SQLite, other database variables (HOST, PORT, etc.) are ignored. Just ensure the database/database.sqlite file exists.

Session and cache

Session configuration

.env
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
SESSION_DRIVER
string
default:"database"
Where sessions are stored: file, cookie, database, memcached, redis
SESSION_LIFETIME
integer
default:"120"
Session lifetime in minutes
Using database for sessions is recommended for production as it’s more reliable and allows session management across multiple servers.

Cache configuration

.env
CACHE_STORE=database
QUEUE_CONNECTION=database
CACHE_STORE
string
default:"database"
Cache driver: file, database, memcached, redis
QUEUE_CONNECTION
string
default:"database"
Queue driver for background jobs: sync, database, redis, sqs

Mail configuration

Configure email sending for user notifications and password resets:
.env
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
MAIL_MAILER
string
default:"log"
Mail driver: smtp, sendmail, mailgun, ses, postmark, log
The log driver is useful for development - emails are written to storage/logs/laravel.log instead of being sent.
For standard SMTP servers:
.env
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}"

Media library

Configure media storage and processing:
.env
FILESYSTEM_DISK=local
MEDIA_DISK=public
FILESYSTEM_DISK
string
default:"local"
Default filesystem disk: local, public, s3
MEDIA_DISK
string
default:"public"
Disk for media library files (uses Spatie Media Library)
The media library configuration is located in config/media-library.php:
config/media-library.php
'disk_name' => env('MEDIA_DISK', 'public'),
'max_file_size' => 1024 * 1024 * 10, // 10MB
'queue_conversions_by_default' => true,
The default maximum file size is 10MB. Increase this if you need to upload larger images:
'max_file_size' => 1024 * 1024 * 50, // 50MB

Amazon S3 storage

For cloud storage using Amazon S3:
.env
FILESYSTEM_DISK=s3
AWS_ACCESS_KEY_ID=your-key-id
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your-bucket-name
AWS_USE_PATH_STYLE_ENDPOINT=false

Security services

Laravel Nightwatch

Nightwatch provides application monitoring and error tracking:
.env
NIGHTWATCH_TOKEN=your-api-key
NIGHTWATCH_TOKEN
string
Your Nightwatch API token for application monitoring
Get your Nightwatch token from nightwatch.io after creating an account.

Cloudflare Turnstile

Turnstile provides bot protection for forms:
.env
TURNSTILE_SITE_KEY="your-site-key"
TURNSTILE_SECRET_KEY="your-secret-key"
TURNSTILE_SITE_KEY
string
Public site key from Cloudflare Turnstile dashboard
TURNSTILE_SECRET_KEY
string
Secret key from Cloudflare Turnstile dashboard
The default values (1x00000000000000000000AA and 2x0000000000000000000000000000000AA) are Cloudflare’s test keys that always pass validation. Replace them with real keys in production.
.env
COOKIEBOT_ID=your-cookiebot-id
COOKIEBOT_ID
string
Your Cookiebot domain group ID for GDPR cookie consent

Performance optimization

PHP configuration

.env
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
PHP_CLI_SERVER_WORKERS
integer
default:"4"
Number of worker processes for PHP’s built-in server
BCRYPT_ROUNDS
integer
default:"12"
Password hashing complexity. Higher is more secure but slower

Logging

.env
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
LOG_LEVEL
string
default:"debug"
Minimum log level: debug, info, notice, warning, error, critical
In production, set LOG_LEVEL=error to reduce log file size and improve performance.

Queue workers

The queue system processes background jobs for media conversions and email sending:
.env
QUEUE_CONNECTION=database
MEDIA_QUEUE=
Start the queue worker:
php artisan queue:listen --tries=1
For production, use a process supervisor like Supervisor to keep the queue worker running.

Vite configuration

Frontend asset building is configured in vite.config.js:
vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
    ],
});
.env
VITE_APP_NAME="${APP_NAME}"

Next steps

First steps

Create your admin account and configure initial settings

Admin panel

Explore the admin dashboard and features

Build docs developers (and LLMs) love