appstract/laravel-options

Global options loaded from the database
478,980 728
Install
composer require appstract/laravel-options
Latest Version:8.0.0
PHP:>=8.3
Laravel:10 – 13
Older releases:5 – 9
License:MIT
Last Updated:May 6, 2026
Links: GitHub  ·  Packagist
Maintainer: gizburdt

Laravel Options

Latest Version on Packagist Total Downloads Software License

Global key-value store in the database

Installation

To get started with laravel-options, use Composer to add the package to your project's dependencies:

composer require appstract/laravel-options

Publish, migrate

By running php artisan vendor:publish --provider="Appstract\Options\OptionsServiceProvider" in your project all files for this package will be published. For this package, it's only a migration. Run php artisan migrate to migrate the table. There will now be an options table in your database.

Usage

With the option() helper, we can get and set options:

// Get option
option('someKey');

// Get option, with a default fallback value if the key doesn't exist
option('someKey', 'Some default value if the key is not found');

// Set option
option(['someKey' => 'someValue']);

// Remove option
option()->remove('someKey');

// Check the option exists
option_exists('someKey');

If you want to check if an option exists, you can use the facade:

use Option;

$check = Option::exists('someKey');

The helpers are available as Blade directives:

@option('someKey')

@option('someKey', 'Default value')

@optionExists('someKey')
    // Code
@endif

Console

It is also possible to set options within the console:

php artisan option:set {someKey} {someValue}

Testing

$ composer test

Contributing

Contributions are welcome, thanks to y'all :)

About Appstract

Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon.

License

The MIT License (MIT). Please see License File for more information.

Related Packages

appstract/laravel-stock

Keep stock for Eloquent models

60,973 288
appstract/laravel-multisite

Multisite setup for Laravel

11,286 214
overtrue/laravel-options

Global options module for Laravel application.

18,622 51

Version History

Version Released PHP Laravel License
8.0.0 >=8.3 ^10.0|^11.0|^12.0|^13.0 MIT
7.0.0 >=8.3 ^10.0|^11.0|^12.0 MIT
6.0.0 >=7.2.5 ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0 MIT
5.7.0 >=7.2.5 ^6.0|^7.0|^8.0|^9.0|^10.0 MIT
5.6.0 >=7.2.5 ^6.0|^7.0|^8.0|^9.0|^10.0 MIT