PHPackages                             overtrue/laravel-options - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. overtrue/laravel-options

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

overtrue/laravel-options
========================

Global options module for Laravel application.

3.2.0(2y ago)5218.5k—0%4[1 PRs](https://github.com/overtrue/laravel-options/pulls)3MITPHP

Since Mar 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/overtrue/laravel-options)[ Packagist](https://packagist.org/packages/overtrue/laravel-options)[ Docs](https://github.com/overtrue/laravel-options)[ GitHub Sponsors](https://github.com/overtrue)[ RSS](/packages/overtrue-laravel-options/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (6)Versions (11)Used By (3)

Laravel Options
===============

[](#laravel-options)

Global options module for Laravel application.

[![Laravel Octane Ready Status](https://camo.githubusercontent.com/1c218651cdc2c4d1b4e72a61bf34ce269474c7322d1e463f615e513789626afa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4f6374616e63652d72656164792d677265656e3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/1c218651cdc2c4d1b4e72a61bf34ce269474c7322d1e463f615e513789626afa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4f6374616e63652d72656164792d677265656e3f7374796c653d666c61742d737175617265)[![GitHub release (latest SemVer)](https://camo.githubusercontent.com/148386856c5b12c0cd46f40f0066519d2a458341858910e4df6df926c7758161/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6f766572747275652f6c61726176656c2d6f7074696f6e733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/148386856c5b12c0cd46f40f0066519d2a458341858910e4df6df926c7758161/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6f766572747275652f6c61726176656c2d6f7074696f6e733f7374796c653d666c61742d737175617265)[![GitHub License](https://camo.githubusercontent.com/a57ed9c8ef9a10749560669155f0abd8b154b0f1f996c43ee34468f1a9f415ae/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f766572747275652f6c61726176656c2d6f7074696f6e733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/a57ed9c8ef9a10749560669155f0abd8b154b0f1f996c43ee34468f1a9f415ae/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f766572747275652f6c61726176656c2d6f7074696f6e733f7374796c653d666c61742d737175617265)[![Packagist Downloads](https://camo.githubusercontent.com/c32c75d2969d29bf8fecb18e3fdbc34f5bc6bb10db40b37397ce35ee0f21b688/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f766572747275652f6c61726176656c2d6f7074696f6e733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/c32c75d2969d29bf8fecb18e3fdbc34f5bc6bb10db40b37397ce35ee0f21b688/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f766572747275652f6c61726176656c2d6f7074696f6e733f7374796c653d666c61742d737175617265)

[![Sponsor me](https://github.com/overtrue/overtrue/raw/master/sponsor-me-button-s.svg?raw=true)](https://github.com/sponsors/overtrue)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require overtrue/laravel-options
```

### Publish configuration and migrations

[](#publish-configuration-and-migrations)

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

### Run migrations

[](#run-migrations)

```
$ php artisan migrate
```

Usage
-----

[](#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

[](#console-commands)

It is also possible to set options within the console:

```
php artisan option:set {key} {value}
```

### Events

[](#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
-------

[](#testing)

```
$ composer test
```

❤️ Sponsor me
-------------

[](#heart-sponsor-me)

[![Sponsor me](https://github.com/overtrue/overtrue/raw/master/sponsor-me.svg?raw=true)](https://github.com/sponsors/overtrue)

如果你喜欢我的项目并想支持它，[点击这里 ❤️](https://github.com/sponsors/overtrue)

Project supported by JetBrains
------------------------------

[](#project-supported-by-jetbrains)

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

[![](https://camo.githubusercontent.com/3cf726e7cdadba47755b7f7ea4227945a92a2fa48aadf4a2573140ec6501c989/68747470733a2f2f7265736f75726365732e6a6574627261696e732e636f6d2f73746f726167652f70726f64756374732f636f6d70616e792f6272616e642f6c6f676f732f6a625f6265616d2e737667)](https://www.jetbrains.com/?from=https://github.com/overtrue)

Contributing
------------

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/overtrue/laravel-options/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/overtrue/laravel-options/issues).
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.*

PHP 扩展包开发
---------

[](#php-扩展包开发)

> 想知道如何从零开始构建 PHP 扩展包？
>
> 请关注我的实战课程，我会在此课程中分享一些扩展开发经验 —— [《PHP 扩展包实战教程 - 从入门到发布》](https://learnku.com/courses/creating-package)

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 75.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~226 days

Recently: every ~317 days

Total

9

Last Release

791d ago

Major Versions

1.0.3 → 2.0.02020-09-21

2.1.0 → 3.0.02022-02-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/c507e57eab402e81335012357b7d7df6c5cafda3073adcc94b475037127d263f?d=identicon)[overtrue](/maintainers/overtrue)

---

Top Contributors

[![overtrue](https://avatars.githubusercontent.com/u/1472352?v=4)](https://github.com/overtrue "overtrue (28 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![summerblue](https://avatars.githubusercontent.com/u/324764?v=4)](https://github.com/summerblue "summerblue (1 commits)")[![tianyong90](https://avatars.githubusercontent.com/u/9278461?v=4)](https://github.com/tianyong90 "tianyong90 (1 commits)")

---

Tags

laravel-optionsoptionssettingsSettingslaravel-optionsovertrue

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/overtrue-laravel-options/health.svg)

```
[![Health](https://phpackages.com/badges/overtrue-laravel-options/health.svg)](https://phpackages.com/packages/overtrue-laravel-options)
```

###  Alternatives

[akaunting/laravel-setting

Persistent settings package for Laravel

495805.1k7](/packages/akaunting-laravel-setting)[chillerlan/php-settings-container

A container class for immutable settings objects. Not a DI container.

3427.3M21](/packages/chillerlan-php-settings-container)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
