PHPackages                             samaphp/laravel-key-value - 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. [Database &amp; ORM](/categories/database)
4. /
5. samaphp/laravel-key-value

ActiveLibrary[Database &amp; ORM](/categories/database)

samaphp/laravel-key-value
=========================

Key/value store collection for Laravel

0.0.1(3y ago)05MITPHPPHP ^7.3|^8.0

Since Jul 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/samaphp/laravel-key-value)[ Packagist](https://packagist.org/packages/samaphp/laravel-key-value)[ RSS](/packages/samaphp-laravel-key-value/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Laravel Key Value
-----------------

[](#laravel-key-value)

Use `samaphp/laravel-key-value` to store key value pair settings in the database. The database table has three fields only. (collection, key, value).

### Installation

[](#installation)

1. Require the package: `composer require samaphp/laravel-key-value`
2. You can directly start using it, please refer to usage examples section below.

### Usage

[](#usage)

```
// The alias already defined but you can use the service from this path
use Samaphp\LaravelKeyValue\LaravelKeyValue;
// system.stats is a collection name. (aka variables group name)
$keyValue = new LaravelKeyValue('system.stats');
$keyValue->set('last_success_sms', time());
print $keyValue->get('last_success_sms', 'DEFAULT_VALUE_HERE');

// Print all variables from the targeted collection (system.stats)
print_r($keyValue->all());

// Delete a specific variable
$keyValue->delete('last_success_sms');

// Shortcut
print (new LaravelKeyValue('system.stats'))->get('last_success_sms');

// You can save an array, which will be encoded in JSON to be saved into the database
$value = ['hi', 'hello'];
$keyValue->set('test', $value);

// Will be decoded and returned as an array
dd($keyValue->set('test'));
```

### Alternatives

[](#alternatives)

This package was inspired by [laravel-settings](https://github.com/qcod/laravel-settings) package by [Mohd Saqueib Ansari](https://github.com/saqueib), but made to be simple and straightforward solution to provide a key/value store functionality. If you are looking for alternatives, you can consider laravel-settings package.

- [laraeast/laravel-settings](https://packagist.org/packages/laraeast/laravel-settings)
- [UniSharp/laravel-settings](https://github.com/UniSharp/laravel-settings)

### Security

[](#security)

If you discover any security related issues, please [open a new issue](https://github.com/samaphp/laravel-key-value/issues/new) using the issue tracker.

### License

[](#license)

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

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

1394d ago

### Community

Maintainers

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

---

Top Contributors

[![samaphp](https://avatars.githubusercontent.com/u/531627?v=4)](https://github.com/samaphp "samaphp (3 commits)")

### Embed Badge

![Health badge](/badges/samaphp-laravel-key-value/health.svg)

```
[![Health](https://phpackages.com/badges/samaphp-laravel-key-value/health.svg)](https://phpackages.com/packages/samaphp-laravel-key-value)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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