Installation
Require the package. The service provider and the Options facade alias are auto-discovered — no manual registration:
composer require roundly-consulting/options-for-laravelPublish and run the migration:
php artisan vendor:publish --tag="options-migrations"
php artisan migratePublish-only migration
The migration is not loaded automatically — the package only publishes it. Until you publish it, php artisan migrate will not create the options table.
If the models that will own options use UUID or ULID primary keys, set the owner key type before you run the migration — the owner_id column type is fixed when the table is created (see Database schema & key type):
# before you publish and run the migration
OPTIONS_KEY_TYPE=uuid # bigint (default), uuid or ulidConfig (optional)
The key type, cache, event, authorization and live-override settings are all env-backed. Publish the config when you want to swap the model or edit the registry, groups or config-bridge maps:
php artisan vendor:publish --tag="options-config"The package’s publish tags are options-migrations and options-config.
Next steps
- Define your first option by extending BaseOption — or scaffold one with make:option.
- Read and write it through the Options facade, the options() helper or the fluent API.
- Add the HasOptions trait to models that own their own settings.
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 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.