Configuration
The published config/options.php in full:
return [
'model' => RoundlyConsulting\Options\Option::class,
// Owner key type: bigint, uuid or ulid — fixed when the migration first runs.
'key_type' => env('OPTIONS_KEY_TYPE', 'bigint'),
'registry' => [
// 'theme' => App\Options\ThemeOption::class,
],
'cache' => [
'enabled' => env('OPTIONS_CACHE_ENABLED', true),
'store' => env('OPTIONS_CACHE_STORE'),
'ttl' => env('OPTIONS_CACHE_TTL', 3600),
'prefix' => env('OPTIONS_CACHE_PREFIX', 'options'),
'tag' => env('OPTIONS_CACHE_TAG', 'options'),
],
'events' => [
'enabled' => env('OPTIONS_EVENTS_ENABLED', true),
'resolved' => env('OPTIONS_EVENTS_RESOLVED', false),
],
'groups' => [
// 'billing' => App\Settings\BillingSettings::class,
],
'authorization' => [
'enabled' => env('OPTIONS_AUTHORIZATION', false),
'use_gate' => env('OPTIONS_AUTHORIZATION_GATE', false),
],
'config_overrides' => [
// 'mail.from.address' => App\Options\MailFromAddressOption::class,
],
'config_overrides_live' => env('OPTIONS_CONFIG_OVERRIDES_LIVE', false),
];Every key
| Key | Default | Env | Purpose |
|---|---|---|---|
model | Option::class | — | Eloquent model that stores values. Must be RoundlyConsulting\Options\Option or a subclass of it; anything else throws. |
key_type | bigint | OPTIONS_KEY_TYPE | Owner key type — bigint, uuid or ulid (case-insensitive). Types owner_id; set it before you migrate. Anything else throws InvalidConfigurationException when the migration runs. |
registry | [] | — | Short string keys → option classes, for key-based access. |
cache.enabled | true | OPTIONS_CACHE_ENABLED | Enable the persistent (cross-request) cache layer. |
cache.store | null | OPTIONS_CACHE_STORE | Cache store name; null or blank (not set) uses the default store. A non-string value throws. |
cache.ttl | 3600 | OPTIONS_CACHE_TTL | Lifetime in seconds — a whole number, at least 1; null caches forever, blank (OPTIONS_CACHE_TTL=) is not set and gives 3600. Junk such as abc or 0 throws instead of silently disabling the cache. |
cache.prefix | options | OPTIONS_CACHE_PREFIX | Cache key prefix. A blank value is not set and uses the default; a non-string value throws. |
cache.tag | options | OPTIONS_CACHE_TAG | Cache tag, so a taggable store (Redis, Memcached) also purges old entries on a flush. A blank value is not set and uses the default; a non-string value throws. |
events.enabled | true | OPTIONS_EVENTS_ENABLED | Dispatch OptionSet / OptionForgotten. Observers and live config overrides ride on these. |
events.resolved | false | OPTIONS_EVENTS_RESOLVED | Also dispatch OptionResolved on every read — chatty, so off by default. |
groups | [] | — | Short keys → OptionGroup classes, for Options::group('key'). |
authorization.enabled | false | OPTIONS_AUTHORIZATION | Enforce per-option authorizeRead() / authorizeWrite() hooks. |
authorization.use_gate | false | OPTIONS_AUTHORIZATION_GATE | Also consult the option.read / option.write Gate abilities when defined. |
config_overrides | [] | — | config() keys → options whose stored value overrides config at boot. |
config_overrides_live | false | OPTIONS_CONFIG_OVERRIDES_LIVE | Re-apply a mapped config key in-process on set() / forget(). |
Environment
Everything except the model and the class maps is env-backed, so most deployments never publish the config:
OPTIONS_KEY_TYPE=bigint
OPTIONS_CACHE_ENABLED=true
OPTIONS_CACHE_STORE=redis
OPTIONS_CACHE_TTL=3600
OPTIONS_CACHE_PREFIX=options
OPTIONS_CACHE_TAG=options
OPTIONS_EVENTS_ENABLED=true
OPTIONS_EVENTS_RESOLVED=false
OPTIONS_AUTHORIZATION=false
OPTIONS_AUTHORIZATION_GATE=false
OPTIONS_CONFIG_OVERRIDES_LIVE=falseThe bool switches accept the usual env spellings: true / false, 1 / 0, on / off and yes / no. Every setting is read strictly: a key that is not set — absent, null or blank (a host’s KEY=) — takes its default, and any other invalid value throws InvalidConfigurationException naming the key instead of falling back.
About command
The package reports its configuration to Laravel’s about command. Option keys, group keys and bridged config paths are shown as counts only — a key names one of your settings and its value can be a token, a feature flag or personal data, so neither is ever printed:
php artisan about --only=optionsShow your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.