PHPackages                             vox/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. vox/data

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

vox/data
========

1.0.0(4y ago)0392MITPHPPHP &gt;=7.4CI failing

Since Apr 2Pushed 4y ago1 watchersCompare

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

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

Vox Data manipulation library
=============================

[](#vox-data-manipulation-library)

With this library you can:

- Serialize php classes into json, xml and create custom formatters
- Unserialize data into php objects (json, xml and custom formats)
- Transfer data between different data structures (from a class instance to a different class instance)
- Normalize php object into array
- Use a property accessor to access private class members
- You can do all that with extension and annotate discriminators
- It's also compatible with ocramius proxies

Usage
-----

[](#usage)

since this library depends on [Vox\\Metadata](https://github.com/jhonatanTeixeira/metadata) package you must obtain a MetadataFactory instance, with it you can then create a ObjectExtractor and a ObjectHydrator instance.

Given the class:

```
class DataClass {
    private string $name;

    public int $age;

    public function __construct($name, $age) {
        $this->name = $name;
        $this->age = $age;
    }

    public function getName() {
        return $this->name;
    }
}
```

You may create your data extractor and hydrator:

```
$mf = (new MetadataFactoryFactory())->createAnnotationMetadataFactory();
$oe = new ObjectExtractor($mf);
$oh = new ObjectHydrator($mf);
```

To extract the data, you may use the extract method and you can provide a context to it, there's a special built in context value called extractType you can use, that will provide a property on the normalized array called **type** with the origin class FQCN (fully qualified class name), that may be useful on the denormalization (hydration) process.

```
$context = ['extractType' => true];
$data = $extractor->extract(new DataClass('John Doe', 18), $context);
```

You can hydrate the data back into a new class or a class instance:

```
$object = $oh->hydrate(DataClass::class, $data);
$oh->hydrate($object, $data);
```

### Data bindings

[](#data-bindings)

You can customize the data input and output by using the @Binding and @Exclude annotations:

```
class DataClass {
    #[Bindings(source: 'first_name', target: 'username')]
    private string $name;

    #[Exclude(input: false, output: true)]
    public int $age;

    public function __construct($name, $age) {
        $this->name = $name;
        $this->age = $age;
    }

    public function getName() {
        return $this->name;
    }
}
```

In this example you can have an input array containing the "first\_name" field and it will be mapped to the name property, and when you extract it, the resulting array will contain this data on the "username" field. These are completely optional in case you want the same field for input and output you can pass only the source, note that 'source' is the first parameter so you can omit the param name like this `#[Bindings('first_name')]`.

The exclusion can also be controlled by input and output, in this case will be used on hydration and be left out on extraction.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~431 days

Total

4

Last Release

1672d ago

Major Versions

0.6.1 → 1.0.02021-10-17

PHP version history (2 changes)0.5.4PHP &gt;=7.0

0.6.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b151b09844eedb0fc2a4a3f5ff6766ec85d3bd1f3c5553e0c117ee279ede952?d=identicon)[jhonatanTeixeira](/maintainers/jhonatanTeixeira)

---

Top Contributors

[![jhonatanTeixeira](https://avatars.githubusercontent.com/u/1003279?v=4)](https://github.com/jhonatanTeixeira "jhonatanTeixeira (6 commits)")[![Guararapes](https://avatars.githubusercontent.com/u/60523424?v=4)](https://github.com/Guararapes "Guararapes (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)

PHPackages © 2026

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