PHPackages                             serlo-org/athene2-hydrator - 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. serlo-org/athene2-hydrator

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

serlo-org/athene2-hydrator
==========================

Zend Framework 2 Module that provides a hydrator for Athene2

06PHP

Since Aug 10Pushed 11y ago2 watchersCompare

[ Source](https://github.com/serlo-org/athene2-hydrator)[ Packagist](https://packagist.org/packages/serlo-org/athene2-hydrator)[ RSS](/packages/serlo-org-athene2-hydrator/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

athene2-hydrator
================

[](#athene2-hydrator)

[![Build Status](https://camo.githubusercontent.com/9ccf5204589d01922eb337b8c3953f1807e5200f523ce65caff1132ce1e38a6c/68747470733a2f2f7472617669732d63692e6f72672f7365726c6f2d6f72672f617468656e65322d6879647261746f722e737667)](https://travis-ci.org/serlo-org/athene2-hydrator)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/06f3fd288817b6f86da3bebc48fa4cecd78e613a91064c5cf8fbb6aae42b54ac/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7365726c6f2d6f72672f617468656e65322d6879647261746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/serlo-org/athene2-hydrator/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/b26eb57fb47e102b0cb790d00bf8bb514e5c406a5f4c2885204e77cfcb86ee8f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7365726c6f2d6f72672f617468656e65322d6879647261746f722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/serlo-org/athene2-hydrator/?branch=master)[![Build Status](https://camo.githubusercontent.com/5c6f793922cfd0f5efdf6afb22589fa4c596f175ee69174c9a56765412fd0b97/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7365726c6f2d6f72672f617468656e65322d6879647261746f722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/serlo-org/athene2-hydrator/build-status/master)

**Attention, this module is not fully tested yet**

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

[](#installation)

athene2-versioning only officially supports installation through Composer. For Composer documentation, please refer to [getcomposer.org](http://getcomposer.org/).

Install the module:

```
$ php composer.phar require serlo-org/athene2-hydrator:dev-master
```

Hydrators?
----------

[](#hydrators)

This Zend Framework 2 module aims to provide you with advanced PluginAware Hydrators for Hydrators bundled with ZF2 and the Doctrine Module. The following Hydrators have been modified for Plugin use:

- [DoctrineObject](https://github.com/doctrine/DoctrineModule/blob/master/docs/hydrator.md)
- `ArraySerializable`
- `ClassMethods`
- `ObjectProperty`
- `Reflection`

Plugins?
--------

[](#plugins)

Object hydration can - sometimes - become difficult. Some hydration steps may need advanced logic. Let's take a real world example:

Bob updates the artists name of a music track entry on a web page. The new artist name is not in the database and needs to be created first and then associated with the track entry. A plugin could do this easily:

```
public function hydrate(array $data, $object)
{
    $data['artist'] = $this->myArtistService->createIfNotExists($data['artist']);
    return $data;
}
```

Usage
-----

[](#usage)

To create a new plugin, just implement `Athene2\Hydrator\Plugin\HydratorPluginInterface`. To add that plugin to the HydratorPluginManager, add the following to your *module.config.php*:

```
return [
    'hydrator_plugins' => [
        'invokables' => [
            'myPlugin' => 'MyNamespace\Hydrator\Plugin\MyPlugin'
        ]
    ]
];
```

The HydratorPluginManager is a ZF2 PluginManager, so you can use the `factory` and `alias` key as well.

Now let's create a Hydrator!

```
$pluginManager = $serviceManager->get('Athene2\Hydrator\Plugin\HydratorPluginManager');
$hydrator      = new PluginAwareClassMethods($pluginManager);

// Let's add the plugin 'myPlugin' to this hydrator
$hydrator->addPlugin('myPlugin');

// The plugin will be called before hydration takes place.
// What you do in the plugin does not matter. You can inject stuff or just modify the hydration data.
// Be aware however, that every key value pair you return will be hydrated by the ClassMethod hydrator.
// Make sure to remove key value pairs, which should be ignored by ClassMethod (or any other hydrator for that matter).
$hydrator->hydrate($myObject, $myData);

// The plugin will be called after extraction takes place.
$data = $hydrator->extract($myObject);
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/45354970?v=4)[arekkas](/maintainers/arekkas)[@arekkas](https://github.com/arekkas)

### Embed Badge

![Health badge](/badges/serlo-org-athene2-hydrator/health.svg)

```
[![Health](https://phpackages.com/badges/serlo-org-athene2-hydrator/health.svg)](https://phpackages.com/packages/serlo-org-athene2-hydrator)
```

###  Alternatives

[jaybizzle/crawler-detect

CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent

2.3k96.7M215](/packages/jaybizzle-crawler-detect)

PHPackages © 2026

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