https://github.com/rostym/hydrator
This is a simple library which provide you possibility to hydrate and extract an object properties (private, protected) without using reflection.
https://github.com/rostym/hydrator
extract-data hydrate hydration hydrator library php
Last synced: 4 months ago
JSON representation
This is a simple library which provide you possibility to hydrate and extract an object properties (private, protected) without using reflection.
- Host: GitHub
- URL: https://github.com/rostym/hydrator
- Owner: rostym
- License: mit
- Created: 2017-02-26T20:36:42.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-04T22:11:56.000Z (about 9 years ago)
- Last Synced: 2025-07-20T03:21:10.988Z (10 months ago)
- Topics: extract-data, hydrate, hydration, hydrator, library, php
- Language: PHP
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hydrator library
[](https://travis-ci.org/Krifollk/hydrator)
This is a simple library which provide you possibility to hydrate and extract an object properties (private, protected) without using reflection.
## Requirements
- PHP 7 and higher
## Installation
Install the latest version with
```bash
$ composer require krifollk/hydrator
```
## Usage Example
Example of hydration an object
```php
hydrate($user, ['name' => 'John', 'surname' => 'Doe']);
print_r($user);
```
Output:
```
User Object
(
[name:User:private] => John
[surname:protected] => Doe
)
```
Example of extracting properties from an object
```php
extractProperties($user, ['name', 'surname']);
print_r($result);
```
Output:
```
Array
(
[name] => John
[surname] => Doe
)
```