PHPackages                             foxlaby/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. foxlaby/laravel-options

Abandoned → [laraveleg/options](/?search=laraveleg%2Foptions)Library[Utility &amp; Helpers](/categories/utility)

foxlaby/laravel-options
=======================

You can create options, reuse them and rely on them at a later time. Inspired by the WordPress system and built on the Laravel framework

1.3.1(4y ago)082[2 issues](https://github.com/laraveleg/options/issues)MITPHP

Since Feb 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/laraveleg/options)[ Packagist](https://packagist.org/packages/foxlaby/laravel-options)[ RSS](/packages/foxlaby-laravel-options/feed)WikiDiscussions main Synced yesterday

READMEChangelog (7)Dependencies (8)Versions (9)Used By (0)

laravel options
===============

[](#laravel-options)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)![Travis](https://camo.githubusercontent.com/366c1e66694e74a663370aeb48acab07a05d228ab93ece41d4ecfceaaf9732d9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c61726176656c65672f6f7074696f6e732e7376673f7374796c653d666c61742d737175617265)[![Total Downloads](https://camo.githubusercontent.com/c5ed7845d3558061f3ba698e7e041b3fcbe4c6d2e9217f747858469bee45479f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c65672f6f7074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laraveleg/options)

You can create options, reuse them and rely on them at a later time. Inspired by the [WordPress](https://codex.wordpress.org/Options_API) system and built on the `Laravel` framework.

Install for laravel
-------------------

[](#install-for-laravel)

```
composer require laraveleg/options
```

Install for lumen
-----------------

[](#install-for-lumen)

```
composer require laraveleg/options
```

### Register service provider

[](#register-service-provider)

Go to `bootstrap/app.php` file and add the following line

```
$app->register(LaravelEG\LaravelOptions\LumenOptionsServiceProvider::class);
```

### Migrate options table

[](#migrate-options-table)

```
php artisan migrate
```

Usage
-----

[](#usage)

You can manage options in a simple way by helpers.

Cache Mode
----------

[](#cache-mode)

### add\_option

[](#add_option)

You can add an option through the following line :-

```
add_option($key, $value, $expiration);
```

`$key`: The option ID that you will use to fetch its value.

`$value`: Put the value of any type of data.

`$expiration`: Expiration date. This can be unused and saved all the time. Ex: `add_option($key, $value)`.

### get\_option

[](#get_option)

Fetching value for a specific option :-

```
get_option($key, $default)
```

`$key`: The option ID. `$default`: You can specify a default value if the option is not found.

### has\_option

[](#has_option)

Make sure the option is there :-

```
has_option($key)
```

`$key`: The option ID.

### remove\_option

[](#remove_option)

You can delete any option :-

```
remove_option($key)
```

`$key`: The option ID.

---

Eloquent Mode
-------------

[](#eloquent-mode)

You can put the settings to a specific element in a specific model.

### Vendor publish

[](#vendor-publish)

```
php artisan vendor:publish --provider="LaravelEG\LaravelOptions\LaravelOptionsServiceProvider"
```

#### Migrate options table

[](#migrate-options-table-1)

```
php artisan migrate
```

### Set config

[](#set-config)

Go to `laraveloptions.php` file in configs directory

```
'eloquent_mode' => true, // Enable Eloquent Mode
```

### Use for model

[](#use-for-model)

Add the trait in your specific model.

```
use LaravelEG\LaravelOptions\Traits\HasLaravelEGOptions;

class Unit extends Model
{
    use HasLaravelEGOptions;
```

### add\_option

[](#add_option-1)

You can add an option through the following line :-

```
$unit = Unit::find(1);
$unit->addOption($key, $value, $expiration);
```

`$key`: The option ID that you will use to fetch its value.

`$value`: Put the value of any type of data.

`$expiration`: Expiration date. This can be unused and saved all the time. Ex: `add_option($key, $value)`.

### get\_option

[](#get_option-1)

Fetching value for a specific option :-

```
$unit = Unit::find(1);
$unit->getOption($key, $default)
```

`$key`: The option ID. `$default`: You can specify a default value if the option is not found.

### has\_option

[](#has_option-1)

Make sure the option is there :-

```
$unit = Unit::find(1);
$unit->hasOption($key)
```

`$key`: The option ID.

### remove\_option

[](#remove_option-1)

You can delete any option :-

```
$unit = Unit::find(1);
$unit->removeOption($key)
```

`$key`: The option ID.

> You an use this `Trait` in any model on your app.

Command-lines
-------------

[](#command-lines)

### Remove all options

[](#remove-all-options)

```
php artisan laraveleg:options:remove-all
```

Remove all options on eloquent mode

Testing
-------

[](#testing)

Run the tests with:

```
vendor/bin/phpunit
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](/LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~36 days

Recently: every ~5 days

Total

7

Last Release

1700d ago

Major Versions

0.2 → 1.02021-08-23

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31162701?v=4)[komicho](/maintainers/komicho)[@komicho](https://github.com/komicho)

---

Top Contributors

[![komtcho](https://avatars.githubusercontent.com/u/12757671?v=4)](https://github.com/komtcho "komtcho (26 commits)")

---

Tags

laravellaravel-frameworkoptionslaraveloptionsfoxlaby

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-options

Create arrays of options from different sources

253294.8k2](/packages/spatie-laravel-options)[stephenjude/filament-blog

Filament Blog Builder

20317.8k](/packages/stephenjude-filament-blog)

PHPackages © 2026

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