PHPackages                             originphp/value-store - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. originphp/value-store

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

originphp/value-store
=====================

OriginPHP ValueStore (KVS)

1.0.6(5y ago)1756↓100%1MITPHPPHP &gt;=7.3.0

Since Jul 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/originphp/value-store)[ Packagist](https://packagist.org/packages/originphp/value-store)[ Docs](https://www.originphp.com)[ RSS](/packages/originphp-value-store/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (8)Used By (1)

ValueStore
==========

[](#valuestore)

[![license](https://camo.githubusercontent.com/6fdb99389fe9d9e8a5c197002a191ace7c8b12a2020c0fa5756cf17aa08a4966/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874477265656e2e737667)](https://camo.githubusercontent.com/6fdb99389fe9d9e8a5c197002a191ace7c8b12a2020c0fa5756cf17aa08a4966/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874477265656e2e737667)[![build](https://github.com/originphp/value-store/workflows/CI/badge.svg)](https://github.com/originphp/value-store/actions)[![coverage](https://camo.githubusercontent.com/47fea8b4444db035cf42051927bec25755ab4a216ada186419d1cdd10126e49e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f726967696e7068702f76616c75652d73746f72652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/originphp/value-store?branch=master)

ValueStore is a Key-Value Store (KVS) which provides a consistent interface for working with various types of stores, including JSON, Yaml, XML and PHP files.

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

[](#installation)

To install this package

```
$ composer require originphp/value-store

```

Usage
-----

[](#usage)

The type of store that is used is detected by the file extension (`json`, `yml`, `xml`, or `php`), if it cannot detect or there is no extension then `json` type will be used. This can also be overridden in the constructor.

You work with this like an object or array, and if the file exists it will load the existing data. To save data call the `save` method.

```
use Origin\ValueStore\ValueStore;

$settings = new ValueStore(storage_path('settings.json'));

$settings->email = 'demo@example.com'
$settings->incomingServer = [
    'host' => 'mail.example.com',
    'port' => 993,
    'encryption' => 'ssl'
];
$settings->active = true;

$settings->save();
```

You can also use `isset`, `unset` and `count`

```
unset($settings->key);
$hasKey = isset($settings->key);
$keys = count($settings);
```

You can iterate through the settings

```
foreach($settings as $key => $value){
    ...
}
```

To increment or decrement values in the store

```
$settings->increment('count');
$settings->decrement('count');
```

You can also pass a second argument with the amount you want to increase or decrease by.

```
$settings->increment('count', 4);
$settings->decrement('count', 3);
```

You can also set/get/check values using functions.

```
$settings->set('foo','bar');
$settings->set(['foo'=>'bar','key'=>'value']); // Set multiple values.

$foo = $settings->get('foo');

$keyExists = $settings->has('foo');
$setting->unset('foo');
$count = $settings->count();
```

You can also access as an array

```
$value = $settings['foo'];
$settings['foo'] = 'bar'
unset($settings['foo']);
$has = isset($settings['foo']);
```

To clear all data in the `ValueStore` (remember to call save if needed).

```
$settings->clear(); // clears all values
```

You can convert the `ValueStore` object to any type on the fly

```
$settings->toArray();
$settings->toJson();
$settings->toPhp();
$settings->toXml(); // requires originphp/xml
$settings->toYaml(); // requires originphp/yaml
```

### Dependencies

[](#dependencies)

To use `Xml` you will need to install the following composer package

```
$ composer require originphp/xml
```

To use `Yaml` you will need to install the following composer package

```
$ composer require originphp/yaml
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

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

Recently: every ~39 days

Total

7

Last Release

1960d ago

PHP version history (3 changes)1.0.0PHP ^7.2.0

1.0.3PHP &gt;=7.2.0

1.0.5PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e8a821333d9c7b7bc2ad3d164d142f65cd3912dea78033d31f76b0f19ba8a0c?d=identicon)[originphp](/maintainers/originphp)

---

Top Contributors

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

---

Tags

jsonkey-valuephpstorevaluexmlyamlphpjsonxmlyamlKey valuevaluestoreoriginPHP

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/originphp-value-store/health.svg)

```
[![Health](https://phpackages.com/badges/originphp-value-store/health.svg)](https://phpackages.com/packages/originphp-value-store)
```

###  Alternatives

[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[dragon-code/codestyler

A tool to automatically fix Coding Style Standards issues by The Dragon Code.

291.8M16](/packages/dragon-code-codestyler)[m1/vars

Vars is a simple to use and easily extendable configuration loader with in built loaders for ini, json, PHP, toml, XML and yaml/yml file types. It also comes with in built support for Silex and more frameworks to come soon.

69124.2k1](/packages/m1-vars)

PHPackages © 2026

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