Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/MiguelNavas19/miapibcv/llms.txt

Use this file to discover all available pages before exploring further.

Environment Configuration

Mi API BCV uses Laravel’s .env file for configuration. This file is created from .env.example during installation.
cp .env.example .env
Never commit your .env file to version control. It contains sensitive credentials and configuration specific to your environment.

Application Settings

Basic Configuration

.env
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:xxx...
APP_DEBUG=true
APP_URL=http://localhost

APP_NAME

Default: Laravel Description: The application name used in logs and error messages. Example:
APP_NAME="Mi API BCV"

APP_ENV

Default: local Options: local, development, staging, production Description: Current environment. Affects error reporting and debugging. Production:
APP_ENV=production

APP_KEY

Description: Encryption key for sessions and encrypted data. Generated by php artisan key:generate.
Changing APP_KEY will invalidate all existing sessions and encrypted data.

APP_DEBUG

Default: true Options: true, false Description: Enable detailed error messages and stack traces. Production:
APP_DEBUG=false
ALWAYS set APP_DEBUG=false in production to prevent exposing sensitive information.

APP_URL

Default: http://localhost Description: Base URL of your application. Used for generating URLs in commands and notifications. Examples:
# Development
APP_URL=http://localhost:8000

# Production
APP_URL=https://api.example.com

Database Configuration

SQLite (Default)

.env
DB_CONNECTION=sqlite
Simplest option for development. Database file: database/database.sqlite Setup:
touch database/database.sqlite
php artisan migrate

MySQL/MariaDB

.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mi_api_bcv
DB_USERNAME=root
DB_PASSWORD=secret
Create database:
CREATE DATABASE mi_api_bcv CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

PostgreSQL

.env
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=mi_api_bcv
DB_USERNAME=postgres
DB_PASSWORD=secret
Create database:
CREATE DATABASE mi_api_bcv;

Remote Database

For cloud databases:
.env
DB_CONNECTION=mysql
DB_HOST=db.example.com
DB_PORT=3306
DB_DATABASE=production_db
DB_USERNAME=api_user
DB_PASSWORD=strong_password
DB_SSL_MODE=require  # For secure connections
Use strong passwords and SSL connections for production databases.

Cache Configuration

Database Cache (Default)

.env
CACHE_STORE=database
Stores cache in the cache table. No additional setup required.

File Cache

.env
CACHE_STORE=file
Stores cache in storage/framework/cache/data/. Good for single-server setups.

Redis Cache

.env
CACHE_STORE=redis
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
Best for:
  • High-traffic applications
  • Multi-server deployments
  • Better performance than database cache
Installation:
# Install Redis server
sudo apt-get install redis-server  # Ubuntu/Debian
brew install redis                 # macOS

# Install PHP extension
pecl install redis

# Start Redis
redis-server
Verify connection:
redis-cli ping
# Should return: PONG

Memcached Cache

.env
CACHE_STORE=memcached
MEMCACHED_HOST=127.0.0.1
MEMCACHED_PORT=11211
Installation:
sudo apt-get install memcached
pecl install memcached
For production, Redis is recommended over Memcached due to better persistence and features.

Queue Configuration

.env
QUEUE_CONNECTION=database
Options:
  • sync - Process jobs immediately (no queue)
  • database - Store jobs in database (default)
  • redis - Use Redis for queue
  • sqs - Amazon SQS
For Mi API BCV, database is sufficient since the rates:update command runs via scheduler, not queues.

Logging Configuration

.env
LOG_CHANNEL=stack
LOG_STACK=single
LOG_LEVEL=debug

LOG_CHANNEL

Options:
  • stack - Multiple channels
  • single - Single file log
  • daily - Daily rotating logs
  • syslog - System log
  • errorlog - PHP error log

LOG_LEVEL

Options (in order of severity):
  • 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
Development:
LOG_LEVEL=debug
Production:
LOG_LEVEL=error

Session Configuration

.env
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

SESSION_DRIVER

Options:
  • database - Store in database (default)
  • file - Store in files
  • cookie - Store in cookies
  • redis - Store in Redis

SESSION_LIFETIME

Default: 120 (minutes) Description: How long sessions remain valid.

Mail Configuration

.env
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
Mi API BCV doesn’t send emails by default, but you can configure it for notifications:

SMTP Configuration

.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="noreply@example.com"
MAIL_FROM_NAME="Mi API BCV"
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your_email@gmail.com
MAIL_PASSWORD=your_app_password
MAIL_ENCRYPTION=tls

Localization

.env
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
For Spanish:
APP_LOCALE=es
APP_FALLBACK_LOCALE=es
APP_FAKER_LOCALE=es_VE

Broadcasting Configuration

.env
BROADCAST_CONNECTION=log
Not used in Mi API BCV. Keep as log unless you need WebSocket support.

Filesystem Configuration

.env
FILESYSTEM_DISK=local
Options:
  • local - Store in storage/app
  • public - Store in storage/app/public
  • s3 - Amazon S3
Mi API BCV doesn’t use file storage by default.

AWS Configuration (Optional)

.env
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
Only needed if using S3 for storage or SQS for queues.

Production Configuration Example

.env (Production)
APP_NAME="Mi API BCV"
APP_ENV=production
APP_KEY=base64:your_generated_key
APP_DEBUG=false
APP_URL=https://api.yourdomain.com

LOG_CHANNEL=daily
LOG_LEVEL=error

DB_CONNECTION=mysql
DB_HOST=your_db_host
DB_PORT=3306
DB_DATABASE=production_db
DB_USERNAME=api_user
DB_PASSWORD=strong_secure_password

CACHE_STORE=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

SESSION_DRIVER=redis
QUEUE_CONNECTION=redis

MAIL_MAILER=smtp
MAIL_HOST=smtp.yourdomain.com
MAIL_PORT=587
MAIL_USERNAME=noreply@yourdomain.com
MAIL_PASSWORD=mail_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="noreply@yourdomain.com"
MAIL_FROM_NAME="Mi API BCV"

Configuration Caching

For better performance in production, cache your configuration:
# Cache configuration
php artisan config:cache

# Clear configuration cache
php artisan config:clear
When configuration is cached, changes to .env won’t take effect until you clear the cache.

Environment-Specific Settings

Development

APP_ENV=local
APP_DEBUG=true
LOG_LEVEL=debug
DB_CONNECTION=sqlite
CACHE_STORE=file

Staging

APP_ENV=staging
APP_DEBUG=true
LOG_LEVEL=info
DB_CONNECTION=mysql
CACHE_STORE=redis

Production

APP_ENV=production
APP_DEBUG=false
LOG_LEVEL=error
DB_CONNECTION=mysql
CACHE_STORE=redis

Security Best Practices

1

Strong APP_KEY

Always generate a fresh key:
php artisan key:generate
2

Secure Database Credentials

Use strong, unique passwords for database users.
3

Disable Debug in Production

APP_DEBUG=false
4

Use HTTPS

Always use HTTPS in production:
APP_URL=https://api.yourdomain.com
5

Environment File Permissions

chmod 600 .env
6

Add .env to .gitignore

Ensure .env is in .gitignore:
.env
.env.backup

Troubleshooting

Clear the configuration cache:
php artisan config:clear
  1. Verify credentials in .env
  2. Test connection:
php artisan tinker
DB::connection()->getPdo();
  1. Check database server is running
  2. Verify firewall rules
  1. Verify Redis is running: redis-cli ping
  2. Check PHP Redis extension: php -m | grep redis
  3. Test connection in tinker:
Redis::ping();

Configuration Reference

For advanced configuration, see Laravel’s configuration files in config/:
  • config/app.php - Application settings
  • config/database.php - Database connections
  • config/cache.php - Cache configuration
  • config/queue.php - Queue settings
  • config/mail.php - Email configuration
  • config/logging.php - Logging channels
Most settings can be controlled via .env variables without modifying config files.

Build docs developers (and LLMs) love