NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

Package exceptions live in RoundlyConsulting\Options\Exceptions and extend the abstract OptionException, so one catch handles all of them:

ExceptionThrown when
InvalidOptionClassNameA key isn’t registered, or a class doesn’t implement OptionInterface — also for unknown entries in config_overrides.
InvalidOptionGroupA group class isn’t an OptionGroup, or group set() gets an identifier that isn’t a member.
InvalidOptionObserverAn observer class-string has no __invoke method.
InvalidOptionPayloadImport JSON is invalid or isn’t an array, a row is neither an array nor an OptionPayload, or a row lacks a string key.
InvalidOwnerModelA CLI --owner isn’t an Eloquent model, --owner-id is missing, or the --as user can’t be found.
UnauthorizedOptionAccess control denies a read or a write.
EncryptionNotSupportedencrypted() is true but castAs() returns a cast instance instead of a string.
OptionExceptionNever directly — the abstract base of every exception above.
use RoundlyConsulting\Options\Exceptions\OptionException;
use RoundlyConsulting\Options\Exceptions\UnauthorizedOption;

try {
    Options::set(MaintenanceModeOption::class, true);
} catch (UnauthorizedOption $e) {
    abort(403);
} catch (OptionException $e) {
    report($e); // any other options error
}

From the framework

  • Illuminate\Validation\ValidationException — a value fails the option’s rules().
  • Illuminate\Contracts\Encryption\DecryptException — encrypted ciphertext was tampered with or the APP_KEY changed.
  • RoundlyConsulting\PackageToolkit\Exceptions\InvalidConfigurationException — a config value is invalid: options.model isn’t Option or a subclass of it, an unknown key_type, a switch that isn’t a boolean, a cache.ttl that isn’t a whole number of at least 1, or a cache.store, cache.prefix or cache.tag that isn’t a string. The message names the key.

Show 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 crypto

By 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.