2017 © Pedro Peláez
 

library hydrator

A simple library which provide you possibility to hydrate and extract an object properties (private, protected) without using reflection.

image

krifollk/hydrator

A simple library which provide you possibility to hydrate and extract an object properties (private, protected) without using reflection.

  • Saturday, March 4, 2017
  • by Krifollk
  • Repository
  • 3 Watchers
  • 2 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Hydrator library

Build Status, (*1)

This is a simple library which provide you possibility to hydrate and extract an object properties (private, protected) without using reflection., (*2)

Requirements

  • PHP 7 and higher

Installation

Install the latest version with, (*3)

$ composer require krifollk/hydrator

Usage Example

Example of hydration an object, (*4)

<?php

class User 
{
    private $name;
    protected $surname;
}

$hydrator = new Krifollk\Hydrator\Hydrator();
$user = new User();

$hydrator->hydrate($user, ['name' => 'John', 'surname' => 'Doe']);

print_r($user);

Output:, (*5)

User Object
(
    [name:User:private] => John
    [surname:protected] => Doe
)

Example of extracting properties from an object, (*6)

<?php

class User
{
    private $name = 'John';
    protected $surname = 'Doe';
}


$hydrator = new Krifollk\Hydrator\PropertyExtractor();
$user = new User();

$result = $hydrator->extractProperties($user, ['name', 'surname']);

print_r($result);

Output:, (*7)

Array
(
    [name] => John
    [surname] => Doe
)

The Versions

04/03 2017

dev-develop

dev-develop

A simple library which provide you possibility to hydrate and extract an object properties (private, protected) without using reflection.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Rostyslav Tymoshenko

04/03 2017

dev-master

9999999-dev

A simple library which provide you possibility to hydrate and extract an object properties (private, protected) without using reflection.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Rostyslav Tymoshenko

04/03 2017

0.2.0

0.2.0.0

A simple library which provide you possibility to hydrate and extract an object properties (private, protected) without using reflection.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Rostyslav Tymoshenko

26/02 2017

0.1.0

0.1.0.0

A simple library which provide you possibility to hydrate an object with private, protected properties without using reflection.

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Rostyslav Tymoshenko