PHPackages                             aaronbullard/firehose - 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. aaronbullard/firehose

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

aaronbullard/firehose
=====================

v1.0.0(7y ago)1131MITPHPPHP ^7.1

Since Nov 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/aaronbullard/firehose)[ Packagist](https://packagist.org/packages/aaronbullard/firehose)[ RSS](/packages/aaronbullard-firehose/feed)WikiDiscussions master Synced 2w ago

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

Firehose Hydrator
=================

[](#firehose-hydrator)

[![Maintainability](https://camo.githubusercontent.com/3073cc727be0606df1dda40f5adfde2e00a3b84c9830701074e643f0e5fe3aca/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35623934363539616165393638343566373032342f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/aaronbullard/firehose/maintainability)[![Test Coverage](https://camo.githubusercontent.com/eb7eff5efa86d295e0c4a5440ee7db2812ee202114d10fec6a2f459bc510bd0c/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35623934363539616165393638343566373032342f746573745f636f766572616765)](https://codeclimate.com/github/aaronbullard/firehose/test_coverage)

PHP Reflection Class helper to Instantiate, Mutate, and Extract data directly within a class.

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

[](#installation)

### Library

[](#library)

```
git clone git@github.com:aaronbullard/firehose.git
```

### Composer

[](#composer)

[Install PHP Composer](https://getcomposer.org/doc/00-intro.md)

```
composer require aaronbullard/firehose
```

### Testing

[](#testing)

```
composer test
```

Usage
-----

[](#usage)

Firehose/Hydrator uses PHP reflection to bypass protected and private attribute constraints.

This can be useful when trying to instantiate objects from a database query using a mapper pattern. This method also allows you to bypass any validation constraints within the constructor.

When trying to persist the object, anemic getters are unnecessary. Instance properties can be exctracted as key/value pairs for database persistence.

Examples
--------

[](#examples)

Given Foo

```
class Foo
{
    private $bar;
    protected $baz;
    private $qux;

    public function __construct($bar, $baz = null, $qux = null)
    {
        $this->bar = $bar;
        $this->baz = $baz;
        $this->qux = $qux;
    }

    public function bar(){ return $this->bar; }
    public function baz(){ return $this->baz; }
}
```

Create a new instance

```
use Firehose\Hydrator;

$foo = Hydrator::newInstance(Foo::class, [
    'bar' => 'bar',
    'baz' => 'baz'
]);

$this->assertInstanceOf(Foo::class, $foo);
$this->assertEquals('bar', $foo->bar());
$this->assertEquals('baz', $foo->baz());
```

Mutating a live instance

```
$foo = new Foo('bar', 'baz');

Hydrator::mutate($foo, [
    'bar' => 'newBar'
]);

$this->assertEquals('newBar', $foo->bar());
```

Extracting data

```
$foo = new Foo('bar', 'baz', 'qux');

$data = Hydrator::extract($foo, ['bar', 'baz', 'qux']);

$this->assertEquals('bar', $data['bar']);
$this->assertEquals('baz', $data['baz']);
$this->assertEquals('qux', $data['qux']);
```

For more examples, see the tests: `tests\HydratorTest.php`

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2777d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/085d40a129f9424a85543852f2c8d2d6cdce7e3f0e4fe6b058ea7eb51edae400?d=identicon)[aaronbullard](/maintainers/aaronbullard)

---

Top Contributors

[![aaronbullard](https://avatars.githubusercontent.com/u/4197300?v=4)](https://github.com/aaronbullard "aaronbullard (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aaronbullard-firehose/health.svg)

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

###  Alternatives

[desandro/imagesloaded

JavaScript is all like \_You images done yet or what?\_

8.9k446.5k1](/packages/desandro-imagesloaded)[pds/skeleton

Standard for PHP package skeletons.

2.4k412.4k247](/packages/pds-skeleton)[szeidler/composer-patches-cli

28254.9k4](/packages/szeidler-composer-patches-cli)[wa72/html-pretty-min

HTML minifier and indenter that works on the DOM tree

22226.6k8](/packages/wa72-html-pretty-min)[apen/additional_reports

Useful information in the reports module : xclass, ajax, cliKeys, eID, general status of the system (encoding, DB, php vars...), hooks, compare local and TER extension (diff), used content type, used plugins, ExtDirect... It can really help you during migration or new existing project (to have a global reports of the system).

13164.0k](/packages/apen-additional-reports)[antistatique/swisstopo

Convert GPS (WGS84) to Swiss (LV03 and LV95) coordinates (and vice versa)

1480.4k](/packages/antistatique-swisstopo)

PHPackages © 2026

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