PHPackages                             bvtterfly/laravel-valuestore - 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. bvtterfly/laravel-valuestore

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

bvtterfly/laravel-valuestore
============================

Easily store some values

1.0.0(4y ago)136[3 PRs](https://github.com/bvtterfly/laravel-valuestore/pulls)MITPHPPHP ^8.0

Since Mar 12Pushed 2y ago1 watchersCompare

[ Source](https://github.com/bvtterfly/laravel-valuestore)[ Packagist](https://packagist.org/packages/bvtterfly/laravel-valuestore)[ Docs](https://github.com/bvtterfly/laravel-valuestore)[ GitHub Sponsors](https://github.com/bvtterfly)[ RSS](/packages/bvtterfly-laravel-valuestore/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (3)Dependencies (14)Versions (7)Used By (0)

🚨 THIS PACKAGE HAS BEEN ABANDONED 🚨

I no longer use Laravel and cannot justify the time needed to maintain this package. That's why I have chosen to abandon it. Feel free to fork my code and maintain your own copy.

Laravel Valuestore
==================

[](#laravel-valuestore)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9f4eb6a65f26dba6cab0df9e0735d1e112fd99ece89ca72d17bb5b57397429fa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f627674746572666c792f6c61726176656c2d76616c756573746f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bvtterfly/laravel-valuestore)[![GitHub Tests Action Status](https://camo.githubusercontent.com/28b781bc1d6b6dd1781debfcb4ae8b9c9dfc57f8b8326f9c5a3f09a451c3509b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f627674746572666c792f6c61726176656c2d76616c756573746f72652f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/bvtterfly/laravel-valuestore/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/898dc0625d1e2e77f0ed8571b7a6c904370c396fbc71331d79ee73b635e02892/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f627674746572666c792f6c61726176656c2d76616c756573746f72652f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/bvtterfly/laravel-valuestore/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/cdb2298c2bd84f8473b0e075ad1c60a5eadf1b4539f03f485fb5bcfca4a223d2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f627674746572666c792f6c61726176656c2d76616c756573746f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bvtterfly/laravel-valuestore)

This package makes it easy to store and retrieve some loose values. The values are saved as JSON/Yaml files. The package integrates with the Laravel filesystem and adds Yaml support by extending the `spatie/valuestore` package.

It can be used like this:

```
use Bvttterfly\Valuestore\Valuestore;

$valuestore = Valuestore::make($filename);

$valuestore->put('key', 'value');

$valuestore->get('key'); // Returns 'value'

$valuestore->has('key'); // Returns true

// Specify a default value for when the specified key does not exist
$valuestore->get('non existing key', 'default') // Returns 'default'

$valuestore->put('anotherKey', 'anotherValue');

// Put multiple items in one go
$valuestore->put(['ringo' => 'drums', 'paul' => 'bass']);

$valuestore->all(); // Returns an array with all items

$valuestore->forget('key'); // Removes the item

$valuestore->flush(); // Empty the entire valuestore

$valuestore->flushStartingWith('somekey'); // remove all items whose keys start with "somekey"

$valuestore->increment('number'); // $valuestore->get('number') will return 1
$valuestore->increment('number'); // $valuestore->get('number') will return 2
$valuestore->increment('number', 3); // $valuestore->get('number') will return 5

// Valuestore implements ArrayAccess
$valuestore['key'] = 'value';
$valuestore['key']; // Returns 'value'
isset($valuestore['key']); // Return true
unset($valuestore['key']); // Equivalent to removing the value

// Valuestore implements Countable
count($valuestore); // Returns 0
$valuestore->put('key', 'value');
count($valuestore); // Returns 1
```

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

[](#installation)

You can install the package via composer:

```
composer require bvtterfly/laravel-valuestore
```

You can publish the config file with:

```
php artisan vendor:publish --tag="valuestore-config"
```

This is the contents of the published config file:

```
return [
    /*
    |--------------------------------------------------------------------------
    | Valuestore Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Here you may specify the filesystem disk that should be used
    | by the Valuestore.
    */
    'disk' => config('filesystems.default'),
];
```

Usage
-----

[](#usage)

To create a Valuestore use the `make` method.

```
$valuestore = Valuestore::make($pathToFile);
```

You can also pass some values as a second argument. These will be added to the valuestore using the `put` method.

```
$valuestore = Valuestore::make($pathToFile, ['key' => 'value']);
```

All values will be saved as json/yaml in the given file.

When there are no values stored, the file will be deleted.

### Cached Valuestore

[](#cached-valuestore)

`Valuestore` would call the `all` method behind the scene to get values from the store every time.

`CachedValuestore` is an extension of `Valuestore` with a local cache. With `CachedValuestore`, the `all` method gets values from the cache instead of reading the file to get the store values.

```
$valuestore = CachedValuestore::make($pathToFile);
```

If you want to clear the cache, You can use the `clearCache` method. It is done during persistence, so you are unlikely to need it.

```
$valuestore->clearCache();
```

Valuestore methods
------------------

[](#valuestore-methods)

You can call the following methods on the `Valuestore` &amp; `CachedValuestore`

### put

[](#put)

```
/**
 * Put a value in the store.
 *
 * @param string|array $name
 * @param string|int|null $value
 *
 * @return $this
 */
public function put($name, $value = null)
```

### get

[](#get)

```
/**
 * Get a value from the store.
 *
 * @param string $name
 *
 * @return null|string
 */
public function get(string $name)
```

### has

[](#has)

```
/*
 * Determine if the store has a value for the given name.
 */
public function has(string $name) : bool
```

### all

[](#all)

```
/**
 * Get all values from the store.
 *
 * @return array
 */
public function all() : array
```

### allStartingWith

[](#allstartingwith)

```
/**
 * Get all values from the store which keys start with the given string.
 *
 * @param string $startingWith
 *
 * @return array
*/
public function allStartingWith(string $startingWith = '') : array
```

### forget

[](#forget)

```
/**
 * Forget a value from the store.
 *
 * @param string $key
 *
 * @return $this
 */
public function forget(string $key)
```

### flush

[](#flush)

```
/**
 * Flush all values from the store.
 *
 * @return $this
 */
 public function flush()
```

### flushStartingWith

[](#flushstartingwith)

```
/**
 * Flush all values from the store which keys start with the specified value.
 *
 * @param string $startingWith
 *
 * @return $this
 */
 public function flushStartingWith(string $startingWith)
```

### pull

[](#pull)

```
/**
 * Get and forget a value from the store.
 *
 * @param string $name
 *
 * @return null|string
 */
public function pull(string $name)
```

### increment

[](#increment)

```
/**
 * Increment a value from the store.
 *
 * @param string $name
 * @param int $by
 *
 * @return int|null|string
 */
 public function increment(string $name, int $by = 1)
```

### decrement

[](#decrement)

```
/**
 * Decrement a value from the store.
 *
 * @param string $name
 * @param int $by
 *
 * @return int|null|string
 */
 public function decrement(string $name, int $by = 1)
```

push
----

[](#push)

```
/**
 * Push a new value into an array.
 *
 * @param string $name
 * @param $pushValue
 *
 * @return $this
 */
public function push(string $name, $pushValue)
```

prepend
-------

[](#prepend)

```
/**
 * Prepend a new value into an array.
 *
 * @param string $name
 * @param $prependValue
 *
 * @return $this
 */
public function prepend(string $name, $prependValue)
```

count
-----

[](#count)

```
/**
 * Count elements.
 *
 * @return int
 */
public function count()
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [ARI](https://github.com/bvtterfly)
- [All Contributors](../../contributors)

[Tim MacDonald](https://github.com/timacdonald) was the original developer of the `CachedValuestore`. We slightly polished the code he created in the [repo](https://github.com/timacdonald/cached-valuestore).

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.4% 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 ~29 days

Total

3

Last Release

1464d ago

Major Versions

0.2.0 → 1.0.02022-05-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/99682351?v=4)[Λгi](/maintainers/bvtterfly)[@bvtterfly](https://github.com/bvtterfly)

---

Top Contributors

[![bvtterfly](https://avatars.githubusercontent.com/u/99682351?v=4)](https://github.com/bvtterfly "bvtterfly (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

laravelbvtterflylaravel-valuestore

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/bvtterfly-laravel-valuestore/health.svg)

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

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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