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

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

ferfabricio/hydrator
====================

Hydrate your object with class setters

4.0.0(2y ago)031.9k↓35.2%13MITPHPPHP &gt;7.0

Since Feb 20Pushed 2y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (1)Versions (8)Used By (3)

[![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 ferfabricio/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\Hydrator\Hydrate` to do this work in a simple way:

```
use FerFabricio\Hydrator\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

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Recently: every ~418 days

Total

7

Last Release

971d ago

Major Versions

1.2.0 → 2.0.02019-04-08

2.0.0 → 3.0.02023-09-21

3.0.1 → 4.0.02023-09-21

PHP version history (2 changes)1.0.0PHP ^7.0

3.0.0PHP &gt;7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/697486?v=4)[Fernando Fabricio dos Santos](/maintainers/ferfabricio)[@ferfabricio](https://github.com/ferfabricio)

---

Top Contributors

[![ferfabricio](https://avatars.githubusercontent.com/u/697486?v=4)](https://github.com/ferfabricio "ferfabricio (23 commits)")

---

Tags

hydratordesign patternsobject creation

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/ferfabricio-hydrator/health.svg)](https://phpackages.com/packages/ferfabricio-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)
