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

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

mehdikhody/laravel-options
==========================

Global key-value store for laravel.

06PHP

Since Aug 28Pushed 2y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#laravel-options)

 [![](logo.png)](logo.png)

Introduction
------------

[](#introduction)

Sometimes you need to create a global key-value store to put your website settings and options that you may change later on the fly without editing your `.env` file everytime you make a change.

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

[](#installation)

To get started with `laravel-options` use composer to add the package to your `composer.json` file:

```
composer require mehdikhody/laravel-options
```

And execute the migration command to create the `options` table:

```
php artisan migrate
```

To customise table name or set some default options, you can publish our config file using the following command:

```
php artisan vendor:publish --provider="Mehdikhody\Options\Providers\OptionsServiceProvider"
```

After that, laravel would generate a config file named `option.php` in the config directory.

```
return [
    'table' => 'options',
    'options' => [
        'tax_fee' => 0.28,
        'is_shop_open' => true
    ]
];
```

If you made a change to the default options later on (after migration), you can run this command to update the `options` table accordingly.

```
php artisan option:seed
```

Usage
-----

[](#usage)

There is three-way that you can choose from:

1. `Mehdikhody\Options\Facades\Option` Facade.
2. helper functions like: `option_set($key, $value)`
3. command line like: `php artisan option:set key value`

### Creat or update an option

[](#creat-or-update-an-option)

Set a given option value.

```
Option::set('name', 'Jon Doe');
option_set('tax_fee', 0.3);
```

### Check if an option exists

[](#check-if-an-option-exists)

Determine if the given option value exists.

```
$hasName = Option::has('name');         // true
$hasAge = option_has('age');            // false
```

### Get an option

[](#get-an-option)

Get the specified option value.

```
$name = Option::get('name');            // Jon Doe
$age = option_get('age', 26);           // 26
```

### Delete an option

[](#delete-an-option)

Delete the specified option value.

```
Option::remove('name');
option_remove('age');
```

### Delete all the options

[](#delete-all-the-options)

Delete all the options and restore the default options in the `config/option.php`.

```
Option::clear();
option_clear();
```

### Get an option model

[](#get-an-option-model)

Get the option model instance to access data like `created_at` or `updated_at`.

```
$model = Option::getModel('tax_fee'); // or option_get_model('tax_fee')
$created_at = $model->created_at;
$updated_at = $model->updated_at;
```

### Console commands

[](#console-commands)

It is also possible to do everything above within the console:

```
php artisan option:set key value
php artisan option:get key
php artisan option:has key
php artisan option:remove key
php artisan option:info key
php artisan option:all
php artisan option:clear
php artisan option:seed
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![mehdikhody](https://avatars.githubusercontent.com/u/22590626?v=4)](https://github.com/mehdikhody "mehdikhody (7 commits)")

### Embed Badge

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

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

###  Alternatives

[denismitr/translit

Russian-English Yandex transliteration package primarily for making slugs

147.1k2](/packages/denismitr-translit)

PHPackages © 2026

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