PHPackages                             softinklab/laravel-keyvalue-storage - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. softinklab/laravel-keyvalue-storage

ActiveLibrary[File &amp; Storage](/categories/file-storage)

softinklab/laravel-keyvalue-storage
===================================

Key-Value Storage for Laravel using Database or JSON File

v1.8(4y ago)97.9k↓18.8%MITPHPPHP &gt;=7.2CI failing

Since Mar 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/SoftinkLab/laravel-keyvalue-storage)[ Packagist](https://packagist.org/packages/softinklab/laravel-keyvalue-storage)[ Docs](https://www.softinklab.com)[ RSS](/packages/softinklab-laravel-keyvalue-storage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (8)Used By (0)

 [![laravel keyvalue storage](https://camo.githubusercontent.com/bdeec3f552504b58ebe5c74100bd1cd618af5923f6e1a17d6782ef800cdf7a02/68747470733a2f2f692e6962622e636f2f684659344c67472f6c61726176656c2d6b657976616c75652d73746f726167652e6a7067)](https://camo.githubusercontent.com/bdeec3f552504b58ebe5c74100bd1cd618af5923f6e1a17d6782ef800cdf7a02/68747470733a2f2f692e6962622e636f2f684659344c67472f6c61726176656c2d6b657976616c75652d73746f726167652e6a7067)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c12b610d39b9eb0e5d1ab392c0503d3a9e4306ab66a8d125f0fce3eecea74c1d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f536f6674696e6b4c61622f6c61726176656c2d6b657976616c75652d73746f72616765)](https://packagist.org/packages/softinklab/laravel-keyvalue-storage)[![Total Downloads](https://camo.githubusercontent.com/347fc67a6697b2b62e3ef571e00cf1e15eda3f409c1305bf99c406417efbd1dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f536f6674696e6b4c61622f6c61726176656c2d6b657976616c75652d73746f72616765)](https://packagist.org/packages/softinklab/laravel-keyvalue-storage)[![Software License](https://camo.githubusercontent.com/da3ddc6aaebddd55049894773e6a8a1c3727e71a2cd01e3baf3001d5bada5ab5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f536f6674696e6b4c61622f6c61726176656c2d6b657976616c75652d73746f72616765)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/28fea71bcb5d6e60c18a4554ae786f2de260bc660783960fe28e3a8e78beb2ef/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f536f6674696e6b4c61622f6c61726176656c2d6b657976616c75652d73746f72616765)](https://travis-ci.com/SoftinkLab/laravel-keyvalue-storage)

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

[](#introduction)

Laravel Key Value Storage is an easy and simple package to store key-value data globally in Laravel. This package supports both Database and JSON File as storage methods. This package also comes with helper which simplify your key-value storage access in Code as well as in Blade Template.

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

[](#installation)

You can install the package via composer:

```
composer require softinklab/laravel-keyvalue-storage
```

### Setup

[](#setup)

This package supports the auto-discovery feature of Laravel 5.5 and above, So skip these Setup instructions if you're using Laravel 5.5 and above.

In `config/app.php` add the following :

1 - Service Provider to the providers array :

```
SoftinkLab\LaravelKeyvalueStorage\KeyValueStorageServiceProvider::class,
```

2 - Class alias to the aliases array :

```
'KVOption' => SoftinkLab\LaravelKeyvalueStorage\Facades\KVOption::class,
```

3 - Publish the config file

```
php artisan vendor:publish --provider="SoftinkLab\LaravelKeyvalueStorage\KeyValueStorageServiceProvider"

```

4 - Migrate database tables

```
php artisan migrate

```

### Configuration

[](#configuration)

You can change the settings in `config/kvstorage.php`.

Example : Databse Storage

```
'method' => 'database',
'table_name' => 'kv_storage',

```

Example : File Storage

```
'method' => 'file',
'disk' => 'local',
'path' => 'kvstorage/',

```

Usage
-----

[](#usage)

### Using FACADE

[](#using-facade)

```
use SoftinkLab\LaravelKeyvalueStorage\Facades\KVOption;

// Check is the option exists. Return true if found.
KVOption::exists('key');

// Get the option value.
KVOption::get('key');

// Get the option value. Default value is optional. If option not found default value is returned.
KVOption::get('key', 'default value');

// Add new option. Comment is optional. Comment is only working in Database Mode.
KVOption::set('key', 'value', 'comment');

// Add multiple options.
// Example Input => [['key1', 'value1', 'comment1'],['key2', 'value2', 'comment2']]
KVOption::setArray('array');

// Increment the value of a given key and return it as integer. Factor is used to determine the step. Default is one.
KVOption::increment('key', 'factor');

// Decrement the value of a given key and return it as integer. Factor is used to determine the step. Default is one.
KVOption::decrement('key', 'factor');

// Delete an option
KVOption::remove('key');
```

### Using Helper

[](#using-helper)

```
// Check is the option exists. Return true if found.
kvoption_exists('someKey');

// Get the option value.
kvoption('key');

// Get the option value. Default value is optional. If option not found default value is returned.
kvoption('key', 'default value');

// Add new option. Comment is optional. Comment is only working in Database Mode.
kvoption(['key','value', 'comment']);

// Add multiple options.
// Example Input => [['key1', 'value1', 'comment1'],['key2', 'value2', 'comment2']]
kvoption('array');
```

### Blade Templates

[](#blade-templates)

You can use `kvoptions()` helper to access key-values in Blade Templates.

```
{{kvoption('key')}}
```

### Console

[](#console)

There are some console commands to perform actions.

**Create an Option**

```
php artisan kvoption:create {key} {value} --comment={comment}
```

*comment is optional.*

**Delete an Option**

```
php artisan kvoption:delete {key}
```

Credits
-------

[](#credits)

This package is inspired by,

- [spatie/valuestore](https://github.com/spatie/valuestore) by Spatie
- [appstract/laravel-options](https://github.com/appstract/laravel-options) by Appstract

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

[](#contributing)

Contributions are welcome! Please refer [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

Laravel Key Value Storage is open-sourced software licensed under the [Apache 2.0 License](LICENSE.md).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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 ~122 days

Recently: every ~183 days

Total

7

Last Release

1514d ago

Major Versions

v0.1 → v1.02020-03-22

PHP version history (4 changes)v0.1PHP ^7.2

1.5PHP &gt;=7.2.5

1.7PHP ^7.3|^8.0

v1.8PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fce2264b58eca40a67c6cfad70ee7cba8509519dd70fb7dbe5cc0ff56c1eb0f?d=identicon)[PasanBhanu](/maintainers/PasanBhanu)

---

Top Contributors

[![PasanBhanu](https://avatars.githubusercontent.com/u/30019118?v=4)](https://github.com/PasanBhanu "PasanBhanu (40 commits)")

---

Tags

appstractjsonkey-valuekey-value-databasekey-value-storelaravellaravel-keylaravel-keyvaluelaravel-optionsstoragelaravel-optionskey value storagejson storagelaravel key value storagesoftink lab

### Embed Badge

![Health badge](/badges/softinklab-laravel-keyvalue-storage/health.svg)

```
[![Health](https://phpackages.com/badges/softinklab-laravel-keyvalue-storage/health.svg)](https://phpackages.com/packages/softinklab-laravel-keyvalue-storage)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15161.6M2.6k](/packages/illuminate-filesystem)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)[madnest/madzipper

Easier zip file handling for Laravel applications.

1382.3M6](/packages/madnest-madzipper)

PHPackages © 2026

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