Overview
Sistema de Ventas uses Laravel’s environment-based configuration system. All sensitive and environment-specific settings are stored in the.env file, which should never be committed to version control.
Initial Setup
Generate application key
Generate a secure encryption key:This will set the
APP_KEY in your .env file.Application Settings
Core Application Variables
.env
APP_NAME
Type: StringDefault:
LaravelRequired: Yes The name of your application. Used in email notifications and other areas where the application needs to identify itself.
APP_ENV
Type: StringDefault:
localRequired: Yes
Options:
local, development, staging, production
Determines the environment your application is running in. Affects error reporting, caching behavior, and other environment-specific features.
APP_KEY
Type: String (Base64 encoded)Required: Yes The encryption key used by Laravel’s encrypter service. Must be a 32-character random string. Generate automatically:
APP_DEBUG
Type: BooleanDefault:
trueRequired: Yes Enables detailed error messages with stack traces. Should be
true for development and false for production.
APP_URL
Type: URLDefault:
http://localhostRequired: Yes The URL of your application. Used for generating URLs from the command line (emails, notifications, etc.).
Database Configuration
.env
DB_CONNECTION
Type: StringDefault:
mysqlRequired: Yes
Options:
mysql, pgsql, sqlite, sqlsrv
The database driver to use. Sistema de Ventas is designed for MySQL.
DB_HOST
Type: String/IPDefault:
127.0.0.1Required: Yes The hostname or IP address of your database server.
DB_PORT
Type: IntegerDefault:
3306Required: Yes The port your database server is listening on.
DB_DATABASE
Type: StringDefault:
sisreservacitaRequired: Yes The name of your database. The SQL schema uses
tutorial_sistema_ventas.
The
.env.example file shows sisreservacita, but you should use tutorial_sistema_ventas to match the provided SQL schema.DB_USERNAME
Type: StringDefault:
rootRequired: Yes The database user with access to your database.
DB_PASSWORD
Type: StringDefault: (empty)
Required: No (for local development) The password for your database user.
Logging Configuration
.env
LOG_CHANNEL
Type: StringDefault:
stackRequired: No
Options:
stack, single, daily, slack, syslog, errorlog
Determines how log messages are written.
LOG_LEVEL
Type: StringDefault:
debugOptions:
debug, info, notice, warning, error, critical, alert, emergency
The minimum level of log messages to record.
Cache & Session Configuration
.env
CACHE_DRIVER
Type: StringDefault:
fileRequired: No
Options:
file, database, redis, memcached, array
Determines where cached data is stored.
SESSION_DRIVER
Type: StringDefault:
fileRequired: No
Options:
file, cookie, database, redis, memcached, array
Determines how session data is stored.
SESSION_LIFETIME
Type: Integer (minutes)Default:
120Required: No The number of minutes before a user session expires.
QUEUE_CONNECTION
Type: StringDefault:
syncRequired: No
Options:
sync, database, redis, sqs, beanstalkd
Determines how queued jobs are processed.
Mail Configuration
.env
MAIL_MAILER
Type: StringDefault:
smtpRequired: Yes
Options:
smtp, sendmail, mailgun, ses, postmark, log
The mail driver to use for sending emails.
MAIL_FROM_ADDRESS
Type: EmailRequired: Yes The default email address used as the “from” address.
MAIL_FROM_NAME
Type: StringRequired: No The default name used as the “from” name.
Redis Configuration
.env
Redis is optional and not required for basic functionality. It’s useful for caching and queues in production.
REDIS_HOST
Type: String/IPDefault:
127.0.0.1
The Redis server hostname.
REDIS_PASSWORD
Type: StringDefault:
null
The Redis server password (if required).
REDIS_PORT
Type: IntegerDefault:
6379
The Redis server port.
Broadcasting Configuration
.env
BROADCAST_DRIVER
Type: StringDefault:
logOptions:
pusher, redis, log, null
Determines how real-time events are broadcast.
Filesystem Configuration
.env
FILESYSTEM_DRIVER
Type: StringDefault:
localOptions:
local, public, s3, ftp
Determines where uploaded files are stored.
AWS Configuration (Optional)
.env
AWS configuration is only needed if you plan to use S3 for file storage or SES for email.
Pusher Configuration (Optional)
.env
Pusher configuration is only needed for real-time broadcasting features.
Additional Settings
MEMCACHED_HOST
Type: String/IPDefault:
127.0.0.1
Environment-Specific Examples
Development Environment
.env
Production Environment
.env
Security Best Practices
- Never commit
.env: Add it to.gitignore - Unique keys per environment: Each environment should have its own
APP_KEY - Strong passwords: Use strong database and Redis passwords
- Disable debug in production: Set
APP_DEBUG=false - Use HTTPS: Set
APP_URLto usehttps://in production - Secure mail credentials: Use app-specific passwords for email services
- Environment variables: Store all secrets in
.env, never hardcode them
Configuration Caching
In production, cache your configuration for better performance:When configuration is cached, the
.env file is not loaded. Make sure to clear the cache after updating environment variables.Troubleshooting
Configuration Not Loading
If changes to.env aren’t taking effect:
-
Clear the configuration cache:
- Restart your development server
Invalid APP_KEY
Database Connection Issues
Verify your database credentials:Next Steps
Database Setup
Configure your database connection
Authentication
Set up user authentication