PHPackages                             am2tec/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. am2tec/hydrator

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

am2tec/hydrator
===============

Hydrate your object with class setters

1.0(3y ago)01.4k↓50%1MITPHPPHP ^7.0|^8.1

Since May 11Pushed 3y agoCompare

[ Source](https://github.com/alberto-morais/hydrator)[ Packagist](https://packagist.org/packages/am2tec/hydrator)[ RSS](/packages/am2tec-hydrator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

[![Build Status](https://camo.githubusercontent.com/551a15620289f3a09d7848006ea92d30c0358c5480e0861a2b6d168f727a51fb/68747470733a2f2f7472617669732d63692e6f72672f666572666162726963696f2f6879647261746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ferfabricio/hydrator) [![codecov](https://camo.githubusercontent.com/10d264d585392c07587f944e617a6449947ad358e90719c5f80d2d83aee8e170/68747470733a2f2f636f6465636f762e696f2f67682f666572666162726963696f2f6879647261746f722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/ferfabricio/hydrator)

Hydrator
========

[](#hydrator)

PHP Library to hydrate objects with class setters

Instalation
-----------

[](#instalation)

```
composer require am2tec/hydrator

```

How use
-------

[](#how-use)

If you have a class like this:

```
class Example
{
    private $test;

    public function setTest($test)
    {
        $this->test = $test;
    }

    public function getTest()
    {
        return $this->test;
    }
}

```

And need to create a object from an array:

```
$myData = [
    'test' => 'this is a test'
];

```

You can use `FerFabricio\Hydrate\Hydrate` to do this work in a simple way:

```
use FerFabricio\Hydratate\Hydrate;

class Example
{
    private $test;

    public function setTest($test)
    {
        $this->test = $test;
    }

    public function getTest()
    {
        return $this->test;
    }
}

$myData = [
    'test' => 'this is a test'
];

$example = Hydratate::toObject(Example::class, $myData);
echo $example->getTest(); // This line will print: this is a test

```

Autoload
--------

[](#autoload)

This library is only compatible with PSR-4, please be sure if your application is well configured to work with this.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.5% 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

Unknown

Total

1

Last Release

1103d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c73888302004cbc23517ec47f2891db5e61ad63f75c817c8c55a6b071bfa1c9?d=identicon)[Am2tec](/maintainers/Am2tec)

---

Top Contributors

[![ferfabricio](https://avatars.githubusercontent.com/u/697486?v=4)](https://github.com/ferfabricio "ferfabricio (17 commits)")[![alberto-morais-oliveira-f](https://avatars.githubusercontent.com/u/162183935?v=4)](https://github.com/alberto-morais-oliveira-f "alberto-morais-oliveira-f (2 commits)")

---

Tags

hydratordesign patternsobject creation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/am2tec-hydrator/health.svg)

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

###  Alternatives

[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[samdark/hydrator

Allows to extract data from an object or create a new object based on data for the purpose of persisting state. Works with private and protected properties.

11476.9k](/packages/samdark-hydrator)[imanghafoori/laravel-decorator

A package to easily decorate your function calls.

13913.0k](/packages/imanghafoori-laravel-decorator)[nutgram/hydrator

Hydrator for PHP 8.0+

12265.2k6](/packages/nutgram-hydrator)[sunrise/hydrator

A flexible strictly-typed hydrator.

1231.1k4](/packages/sunrise-hydrator)

PHPackages © 2026

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