PHPackages                             asgard/data - 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. asgard/data

ActiveAsgard-bundle

asgard/data
===========

v0.3.1(9y ago)0302MITPHPPHP &gt;=5.5.9

Since Sep 9Pushed 9y agoCompare

[ Source](https://github.com/asgardphp/data)[ Packagist](https://packagist.org/packages/asgard/data)[ RSS](/packages/asgard-data/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

\#Data

[![Build Status](https://camo.githubusercontent.com/71ebb0155f03dd495f0a545305b8a3c1db0b929aac33c4bd13f0efb58bbd50fd/68747470733a2f2f7472617669732d63692e6f72672f6173676172647068702f646174612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/asgardphp/data)

Data is package for key-value database storage.

- [Installation](#installation)
- [Usage in the Asgard Framework](#usage-asgard)
- [Usage outside the Asgard Framework](#usage-outside)
- [Fetch a value](#fetch)
- [Store a value](#store)
- [Delete a key](#delete)
- [Check for a key existence](#check)
- [Working with different data types](#types)

\##Installation **If you are working on an Asgard project you don't need to install this library as it is already part of the standard libraries.**

```
composer require asgard/data 0.*

```

\##Usage in the Asgard Framework

```
$data = $container['data'];

```

The [container](docs/container) is often accessible as a method parameter or through a [ContainerAware](docs/container#containeraware) object. You can also use the [singleton](docs/container#usage-outside) but it is not recommended.

\##Usage outside the Asgard Framework

```
$config = [
	'host' => 'localhost',
	'user' => 'root',
	'password' => '',
	'database' => 'asgard',
	'prefix' => '',
	'driver' => 'mysql'
];
$db = new \Asgard\Db\DB($config);
$data = new \Asgard\Data\Data($db);

```

\##Fetch a value

```
$data->get('key', 'default'); #'default' if returned in the value could not fetched
#or
$data['key'];

```

\##Store a value

```
$data->set('key', 'value');
#or
$data['key'] = 'value';

```

\##Delete a key

```
$data->delete('key');
#or
unset($data['key']);

```

\##Check for a key existence

```
$data->has('key');
#or
isset($data['key']);

```

\##Working with different data types

Register a type

```
$data->register('obj',
	function($obj) {
		return serialize($obj);
	},
	function($str) {
		return unserialize($str);
	}
);

```

Store a value with a specific type

```
$obj = new StdClass;
$obj->name = 'bob';
$data->set('key', $obj, 'obj');

```

\###Contributing

Please submit all issues and pull requests to the [asgardphp/asgard](http://github.com/asgardphp/asgard) repository.

### License

[](#license)

The Asgard framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Total

4

Last Release

3648d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.4.0

v0.3.0PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/849017ae3ff0c90a272e935f9c1db9a64692db4a2a18a8d0e4bf9dbcd6f74e2c?d=identicon)[leyou](/maintainers/leyou)

---

Top Contributors

[![h0gar](https://avatars.githubusercontent.com/u/439138?v=4)](https://github.com/h0gar "h0gar (43 commits)")

### Embed Badge

![Health badge](/badges/asgard-data/health.svg)

```
[![Health](https://phpackages.com/badges/asgard-data/health.svg)](https://phpackages.com/packages/asgard-data)
```

###  Alternatives

[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[overtrue/laravel-versionable

Make Laravel model versionable.

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

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k4](/packages/elgg-elgg)[neos/flow

Flow Application Framework

862.0M449](/packages/neos-flow)[neos/flow-development-collection

Flow packages in a joined repository for pull requests.

144179.3k3](/packages/neos-flow-development-collection)[rias/statamic-redirect

28298.4k](/packages/rias-statamic-redirect)

PHPackages © 2026

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