Configuration
Configuration files live in config/. Each file returns a PHP array and maps to a key you access with Config::get() or the config() helper.
Environment variables
All sensitive or environment-specific values go in .env:
APP_NAME=HexaGen
APP_ENV=production # local | production | testing
APP_DEBUG=false # show stack traces (never true in production)
APP_URL=https://my-app.com
APP_KEY=your-32-char-random-key
DB_DRIVER=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_app
DB_USER=root
DB_PASSWORD=secret
CACHE_DRIVER=redis
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
QUEUE_DRIVER=database
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_FROM=noreply@my-app.com
JWT_SECRET=your-jwt-secret
SESSION_NAME=hexagen_session
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=Reading config values
config('app.name'); // "HexaGen"
config('app.debug', false); // with default
Config::get('mail.driver'); // static accessCaching config for production
php hexaphp config:cache # compiles all config files into a single cached file
php hexaphp config:clear # removes the cacheAlways run config:cache before deploying to production.
Available config files
| File | Key | Contents |
|---|---|---|
config/app.php | app | Name, URL, debug, key, timezone |
config/auth.php | auth | Guards, providers |
config/cache.php | cache | Driver, TTL, Redis options |
config/cors.php | cors | Allowed origins, methods, headers |
config/csrf.php | csrf | Excluded routes |
config/filesystems.php | filesystems | Disks (local, S3) |
config/logging.php | logging | Channel, log path |
config/mail.php | mail | Driver, SMTP settings |
config/queue.php | queue | Driver, connection |
config/rate-limiting.php | rate-limiting | Max attempts, decay |
Application paths
Every path the framework uses (.env, config/, src/Slices/, database/, resources/views/, lang/, storage/, public/) is resolved against the application root. By default that is the root Composer package: this repository when you work on the framework itself, or your app when the framework is installed in vendor/.
use HexaGen\Core\Application;
Application::basePath(); // /var/www/my-app
Application::basePath('database'); // /var/www/my-app/database
Application::configPath('app.php'); // /var/www/my-app/config/app.php
Application::slicesPath('Flights'); // /var/www/my-app/src/Slices/Flights
Application::storagePath('logs'); // /var/www/my-app/storage/logs
Application::frameworkPath(); // where HexaGen PHP itself is installedTo use a different root (for example in tests), set it before booting the kernel:
Application::setBasePath('/path/to/app');When the framework is a dependency, the CLI is available as vendor/bin/hexaphp. Error pages fall back to the framework's own views when your app does not define resources/views/errors/.
Telemetry
Request tracing is off by default. Turn it on with:
TELEMETRY_ENABLED=true
OTEL_EXPORTER=otlp # or log
OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318/v1/traces
OTEL_SERVICE_NAME=my-app
TELEMETRY_TRACE_QUERIES=false # one span per SQL query when trueEach request gets a span and an X-Trace-Id response header. The otlp exporter sends spans to an OpenTelemetry collector (Jaeger, Grafana Tempo, Zipkin). The log exporter writes one debug line per request to the log, which is fine for local debugging but grows the log file quickly in production. Measured with FrankenPHP in worker mode, the log exporter cut throughput on a JSON route by about a third.