PHPackages                             stratadox/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. [Database &amp; ORM](/categories/database)
4. /
5. stratadox/hydrator

ActiveLibrary[Database &amp; ORM](/categories/database)

stratadox/hydrator
==================

v6.0.1(5y ago)1977[1 PRs](https://github.com/Stratadox/Hydrator/pulls)4MITPHPPHP &gt;=7.2CI passing

Since Nov 12Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/Stratadox/Hydrator)[ Packagist](https://packagist.org/packages/stratadox/hydrator)[ RSS](/packages/stratadox-hydrator/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (7)Versions (19)Used By (4)

Hydrator
========

[](#hydrator)

[![Build Status](https://camo.githubusercontent.com/f2a66775c94452b6e7e36a3ed99bc614ac6d1765ad0cf403189cdd7c1a1dce8b/68747470733a2f2f636972636c6563692e636f6d2f67682f537472617461646f782f4879647261746f722e7376673f7374796c653d736869656c64)](https://app.circleci.com/pipelines/github/Stratadox/Hydrator)[![codecov](https://camo.githubusercontent.com/81e5ba299f42dd578a8f6a365da80617979ca53fa25fa9c0ef59e43990891b88/68747470733a2f2f636f6465636f762e696f2f67682f537472617461646f782f4879647261746f722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Stratadox/Hydrator)[![Infection Minimum](https://camo.githubusercontent.com/416cfd74a77aee9719fd9a0c0b5f9dd6970485b055c1e9a4cd01ce05e08a1754/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d73692d3130302d627269676874677265656e2e737667)](https://app.circleci.com/pipelines/github/Stratadox/Hydrator)[![PhpStan Level](https://camo.githubusercontent.com/fea51e527bede503df965094b675f2d69410677df2767431d51dd33dd584c556/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068707374616e2d382d627269676874677265656e2e737667)](https://app.circleci.com/pipelines/github/Stratadox/Hydrator)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/211f01721881185ecfc51972a3bbf406e07167402d0d1e1657f9a08ec353aa52/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f537472617461646f782f4879647261746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Stratadox/Hydrator/?branch=master)[![Maintainability](https://camo.githubusercontent.com/1f78855480109995cfaef1b5d7cdbc56ff6cf670a6c361c55d040cb382be245b/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f64323537636331643230656565626132613935632f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/Stratadox/Hydrator/maintainability)[![Latest Stable Version](https://camo.githubusercontent.com/1b19bcb0dda447760f2f2f6452ee949b26d7355ee194e1833f26cb51da307e02/68747470733a2f2f706f7365722e707567782e6f72672f737472617461646f782f6879647261746f722f762f737461626c65)](https://packagist.org/packages/stratadox/hydrator)[![License](https://camo.githubusercontent.com/bcdd833f99d75f9c22ec5f722d2588702be2f6d050c6ef654fd8f9e3d0487274/68747470733a2f2f706f7365722e707567782e6f72672f737472617461646f782f6879647261746f722f6c6963656e7365)](https://packagist.org/packages/stratadox/hydrator)

[![Implements](https://camo.githubusercontent.com/6bcfbb03d5cf753c1c7d010fc4cab923b88b7231cb9e7827e40176c4c5787637/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f696e74657266616365732d6769746875622d626c75652e737667)](https://github.com/Stratadox/HydratorContracts)[![Latest Stable Version](https://camo.githubusercontent.com/99e25de836d5889767c45635a5dde9f037a2e9ab1506acd613938c7dff40ad6a/68747470733a2f2f706f7365722e707567782e6f72672f737472617461646f782f6879647261746f722d636f6e7472616374732f762f737461626c65)](https://packagist.org/packages/stratadox/hydrator-contracts)[![License](https://camo.githubusercontent.com/c841b29b5b45a01e5ae8e835d9565ea601d00ce440d29331ff75e03ae8b84759/68747470733a2f2f706f7365722e707567782e6f72672f737472617461646f782f6879647261746f722d636f6e7472616374732f6c6963656e7365)](https://packagist.org/packages/stratadox/hydrator-contracts)

Lightweight hydrators, usable for various hydration purposes. Hydrate away!

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

[](#installation)

Install with composer:

`composer require stratadox/hydrator`

What is this?
-------------

[](#what-is-this)

The `Hydrator` package exists in the context of object deserialization. It is useful when loading objects from a data source.

To *hydrate* an object, means to assign values to its properties.

A [`Hydrator`](https://github.com/Stratadox/HydratorContracts) populates the fields of other objects.

Hydration generally works in tandem with [`Instantiation`](https://github.com/Stratadox/Instantiator); the process of creating empty objects.

How to use this?
----------------

[](#how-to-use-this)

### Basic Objects

[](#basic-objects)

The most basic usage looks like this:

```
