New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

overtrue/laravel-options

Global options module for Laravel application.
18,626 51
Install
composer require overtrue/laravel-options
Latest Version:4.0.0
PHP:^8.3
Laravel:13
Older releases:5 – 11
License:MIT
Last Updated:Oct 4, 2026
Links: GitHub  ·  Packagist
Maintainer: overtrue

Laravel Options

Global options module for Laravel application.

Laravel Octane Ready Status GitHub release (latest SemVer) GitHub License Packagist Downloads

Sponsor me

Requirements

Version 4 requires PHP 8.3 or newer and Laravel 13.x. Applications using Laravel 9–11 should remain on the 3.x release line.

See UPGRADE.md when upgrading from 3.x.

Installation

You can install the package via composer:

composer require overtrue/laravel-options:^4.0

Publish configuration and migrations

$ php artisan vendor:publish --provider="Overtrue\LaravelOptions\OptionsServiceProvider"

Run migrations

$ php artisan migrate

Usage

// set
\Option::set('foo', 'bar');
\Option::set(['foo' => 'bar', 'bar' => 'baz']);

// get
\Option::get('foo'); // bar
\Option::get(['foo', 'bar']); // ['foo' => 'bar', 'bar' => 'baz']
\Option::all(['foo', 'bar']); // ['foo' => 'bar', 'bar' => 'baz']

// get all
\Option::get();
// or
\Option::all();

// check exists
\Option::has('foo'); // true

\Option::remove('foo');
\Option::remove(['foo', 'bar']);

Console commands

It is also possible to set options within the console:

php artisan option:set {key} {value}

Events

  • \Overtrue\LaravelOptions\Events\OptionCreated::class
  • \Overtrue\LaravelOptions\Events\OptionUpdated::class
  • \Overtrue\LaravelOptions\Events\OptionSaved::class
  • \Overtrue\LaravelOptions\Events\OptionDeleted::class
  • \Overtrue\LaravelOptions\Events\OptionRetrieved::class
  • \Overtrue\LaravelOptions\Events\Event::class

Testing

$ composer test

:heart: Sponsor me

Sponsor me

如果你喜欢我的项目并想支持它,点击这里 :heart:

Project supported by JetBrains

Many thanks to Jetbrains for kindly providing a license for me to work on this and other open-source projects.

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT

Related Packages

appstract/laravel-options

Global options loaded from the database

480,894 728
npabisz/laravel-settings

Settings for Laravel.

8,789 27
merodiro/settings

Easy global/user settings

2,713 35
smatar/laravel-settings

Simple Settings package for laravel application

2,405 0
webmachine/settings

Settings for Laravel 5

396 0

Version History

Version Released PHP Laravel License
4.0.0 ^8.3 ^13.0 MIT
3.2.0 ^9.0|^10.0|^11.0 MIT
3.1.0 ^9.0|^10.0 MIT
3.0.0 ^9.0 MIT
2.1.0 >=7.1 ~5.5||~6.0||~7.0||~8.0 MIT