---
title: Hydrator
---

# Hydrator

<div class="documentation__toc"></div>

## Introduction

The hydrator service is a simple class that walks over an array and tries to "hydrate" or populate with public mutator methods.

## Basic Usage

You can hydrate your values by using the `\Anomaly\Streams\Platform\Support\Hydrator` class.

### hydrate

The `hydrate` method hydrates an `object` with the provided array of `parameters`.

The parameter `keys` values will be used to guess `setter` methods.

```php
$hydrator = app(\Anomaly\Streams\Platform\Support\Hydrator::class);

$person = new Person();

$hydrator->hydrate($person, [
    'name' => 'Ryan',   // $person->setName('Ryan');
    'color' => 'Green', // $person->setColor('Green');
]);
```

> Hydration is an important step in the **build** process in [UI builders](../ui).{.tip}
