Configuration Cheat Sheet
Configuration Cheat Sheet
The Hazaar framework uses a powerful configuration system that allows for environment-based settings. Configuration files are located in the configs directory.
The main configuration file is app.php. Other subsystems may use their own configuration files (e.g. database.php).
Configuration files usually return an array with top-level keys representing the environment (e.g., production, development).
Application (app)
Core application settings found under the app key.
| Option | Type | Default | Description |
|---|---|---|---|
name | string | The name of the application. | |
timezone | string | UTC | The default timezone for the application (e.g., Australia/Canberra). |
root | string | (auto) | The absolute path to the application root. |
base | string | (auto) | The base URL of the application. |
rewrite | boolean | true | Enable or disable URL rewriting support. |
favicon | string | favicon.png | Path to the favicon file. |
errorController | string | null | The controller to handle errors. |
responseType | string | html | Default response type (html, json, xml, text). |
locale | string | The default locale for the application. | |
polyfill | boolean | true | Enable PHP polyfills for newer functions. |
responseImageCache | boolean | false | Enable response image caching. |
maxload | float | Maximum system load before rejecting requests (requires sys_getloadavg). | |
log | array | Application logging configuration (see Logger section). | |
alias | array | Key-value pairs of URL aliases. | |
files | array | Map of boot files to load (bootstrap, shutdown, route, media, request, complete). | |
runtimePath | string | .runtime | Path to the runtime data directory. |
PHP Settings (php)
These settings are mapped directly to PHP configuration directives using ini_set.
| Option | Example | Description |
|---|---|---|
display_errors | 0 or 1 | Enable or disable PHP error display. |
display_startup_errors | 0 or 1 | Enable or disable PHP startup errors. |
date.timezone | UTC | Set PHP timezone (alternative to app.timezone). |
| (Any php.ini) | Any valid PHP configuration directive. |
Paths (paths)
Defines the directory layout for application components relative to the application path.
| Option | Default | Description |
|---|---|---|
base | Base search path. | |
model | models | Directory for models. |
view | views | Directory for views. |
controller | controllers | Directory for controllers. |
service | services | Directory for services. |
helper | helpers | Directory for helpers. |
event | events | Directory for event handlers. |
listener | listeners | Directory for event listeners. |
middleware | middleware | Directory for middleware. |
exception | exceptions | Directory for exception classes. |
Router (router)
Configures the request router.
| Option | Default | Description |
|---|---|---|
type | file | Router type (file, basic, advanced, json, etc). |
controller | index | Default controller name. |
action | index | Default action name. |
errorController | Controller to use when a route is not found. | |
file | route.php | The route file to load (for file or json router types). |
aliases | Array of route aliases (for advanced router). |
Action (action)
Settings for Controller Actions.
| Option | Description |
|---|---|
layout | The default view layout template to use (e.g., application). |
Error (error)
Error handling configuration.
| Option | Type | Default | Description |
|---|---|---|---|
view | string | @views/error | The view template to use for error pages. |
controller | string | Hazaar\Controller\Error | The controller class to handle errors. |
Middleware (middleware)
Middleware configuration for request processing pipeline.
| Option | Type | Description |
|---|---|---|
aliases | array | Key-value pairs mapping middleware aliases to class names. |
global | array | Array of middleware to apply globally to all requests. |
HTTP (http)
HTTP response settings.
Cache Control (cacheControl)
Configures the Cache-Control header defaults.
| Option | Type | Default | Description |
|---|---|---|---|
public | boolean | false | Set public directive. |
private | boolean | Set private directive. | |
no-cache | boolean | Set no-cache directive. | |
no-store | boolean | Set no-store directive. | |
max-age | integer | 300 | Max age in seconds. |
reply | string | Custom reply string (e.g. no-transform). |
Authentication (auth)
Configuration for the authentication manager. The auth section now supports more options for defining the backend and transport, as well as their configuration keys.
| Option | Description |
|---|---|
adapter | Authentication adapter class or name. |
backend | Session backend class or name (e.g., Hazaar\Auth\Session\Backend\Cache). |
transport | Session transport class or name (e.g., Hazaar\Auth\Session\Transport\Cookie). |
cache | Backend-specific options (e.g., for Cache backend: adapter, ttl, path). |
cookie | Transport-specific options (e.g., for Cookie transport: cookie_name, secure, samesite). |
header | Transport-specific options (e.g., for Header transport: name, prefix). |
session | Session configuration for auth storage. |
jwt | JWT configuration (see below). |
Example
'auth' => [
'adapter' => \App\Model\Auth::class,
'backend' => \Hazaar\Auth\Session\Backend\Cache::class,
'transport' => \Hazaar\Auth\Session\Transport\Cookie::class,
'cache' => [
'adapter' => 'file',
'ttl' => 3600,
],
'cookie' => [
'cookie_name' => 'myapp_auth',
'secure' => true,
'samesite' => 'Strict',
],
],See the documentation for each backend and transport for their available configuration keys.
JWT (jwt)
| Option | Description |
|---|---|
issuer | The token issuer Claim (iss). |
timeout | Token expiration time in seconds (default 3600). |
refresh | Refresh token expiration time. |
alg | Hashing algorithm (e.g. HS256). |
passphrase | Secret key for signing tokens. |
fingerprintIP | Bind token to IP address (boolean). |
keyfile | Path to key file. |
Session (session)
Session management settings.
| Option | Description |
|---|---|
name | The session name (cookie name). |
timeout | Session timeout in seconds. |
backend | Session storage backend (if using Cache backend). |
Cache (cache)
Global cache configuration.
| Option | Description |
|---|---|
backend | Cache backend driver (e.g., file, apcu, redis, memcached, session). |
options | Array of backend-specific options. |
Mail (mail)
Email sending configuration.
| Option | Default | Description |
|---|---|---|
enable | true | Enable or disable mail sending. |
transport | smtp | Mail transport backend. |
server | SMTP Server hostname. | |
port | SMTP Port. | |
timeout | Connection timeout. | |
from | Default 'From' address. | |
testmode | Enable test mode (no sending). | |
subjectPrefix | Prefix string for all email subjects. | |
override | Array for overriding recipients (to, cc, bcc). | |
noOverrideMatch | Regex pattern to exclude addresses from override. |
Logger (log)
Application logging configuration.
| Option | Type | Description |
|---|---|---|
enabled | boolean | Enable logging. |
level | string | Log level (e.g. NOTICE, info, debug, error). |
backend | string | Log backend (e.g., file, database, syslog). |
options | array | Backend-specific options. |
Database (database file)
Typically found in a separate database.php config file.
| Option | Type | Description |
|---|---|---|
type | string | Database driver (pgsql, mysql, sqlite, etc). |
host | string | Database hostname. |
port | integer | Database port. |
dbname | string | Database name. |
user | string | Username. |
password | string | Password. |
schema | string | Default schema (e.g. public for pgsql). |
timezone | string | Connection timezone. |
encrypt | array | Encryption settings (key, keyfile, table). |
Metrics (metrics)
Performance metrics configuration.
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable internal performance metrics collection. |
file | string | metrics.dat | Path to the metrics data file (relative to runtime path). |
archives | array | (see below) | Array of metric archive configurations for different time periods. |
Archive Configuration
Each archive entry in the archives array should contain:
| Option | Type | Description |
|---|---|---|
id | string | Unique identifier for the archive. |
type | string | Archive type (COUNT, AVERAGE, etc.). |
step | integer | Number of intervals per data point (in 10-second units). |
rows | integer | Number of data points to retain. |
description | string | Human-readable description of the archive. |
Default archives: Count and average metrics are collected per minute (last hour), per hour (last day and week), and per day (last year).
Warlock (warlock)
Configuration for the Warlock service runner.
| Option | Description |
|---|---|
server | Server settings (address, port, id, encode). |
adminKey | Key for admin authentication. |
schedule | List of scheduled tasks. |
timezone | Scheduler timezone. |
cluster | Cluster settings (enabled, peers, accessKey). |
kvstore | KV Store settings (enabled, persist, compact). |