Configuration
Configuration Files
Application configuration lives in the config/ directory.
php
// config/app.php
return [
'name' => $_ENV['APP_NAME'] ?? 'Lighthouse',
'debug' => (bool) ($_ENV['APP_DEBUG'] ?? true),
'url' => $_ENV['APP_URL'] ?? 'http://localhost:8000',
];Environment Variables
Use a .env file for environment-specific settings:
APP_NAME=Lighthouse
APP_DEBUG=true
APP_URL=http://localhost:8000Copy .env.example to .env to get started:
bash
cp .env.example .envDebug Mode
When debug is true:
- Detailed error pages with stack traces
- Exception class names and file locations
- Request information displayed
When debug is false:
- Clean, user-friendly error pages
- Generic error messages
- No sensitive information exposed
WARNING
Always set debug to false in production!
Accessing Configuration
In your application:
php
$config = require __DIR__ . '/../config/app.php';
$app = new Application(
basePath: dirname(__DIR__),
debug: $config['debug']
);