2017 © Pedro Peláez
 

library hydrate

Hydrate an object from an array of properties.

image

keven/hydrate

Hydrate an object from an array of properties.

  • Monday, April 9, 2018
  • by Keven
  • Repository
  • 0 Watchers
  • 2 Stars
  • 815 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 143 % Grown

The README.md

keven/hydrate

Latest Stable Version Build Status License Total Downloads, (*1)

Hydrate an object from an array of properties., (*2)

Install

$ composer install keven/hydrate

Usage

Hydrate a given object:, (*3)

<?php

$obj = new stdClass;
\Keven\hydrate(array('foo' => 'bar'), $obj);
echo $obj->foo; // "bar"

Hydrate from $this (you don't have to pass the object parameter):, (*4)

<?php

$car = new Car(array(
    'engine' => 'V8',
    'color'  => 'red',
    'brand'  => 'Chevrolet',
));
echo $car->getColor(); // "red"

class Car
{
    private $engine, $color, $brand;

    public function __construct($args)
    {
        hydrate($args);
    }

    public function getEngine()
    {
        return $this->engine;
    }

    public function getColor()
    {
        return $this->color;
    }

    public function getBrand()
    {
        return $this->brand;
    }
}

The Versions

09/04 2018

dev-master

9999999-dev

Hydrate an object from an array of properties.

  Sources   Download

MIT

The Requires

 

09/04 2018

1.0.5

1.0.5.0

Hydrate an object from an array of properties.

  Sources   Download

MIT

The Requires

 

09/04 2018

1.0.4

1.0.4.0

Hydrate an object from an array of properties.

  Sources   Download

MIT

The Requires

 

09/04 2018

1.0.3

1.0.3.0

Hydrate an object from an array of properties.

  Sources   Download

MIT

The Requires

 

09/04 2018

1.0.2

1.0.2.0

Hydrate an object from an array of properties.

  Sources   Download

MIT

The Requires

 

09/04 2018

1.0.1

1.0.1.0

Hydrate an object from an array of properties.

  Sources   Download

MIT

The Requires

 

09/04 2018

1.0.0

1.0.0.0

Import an array of parameters into an object properties.

  Sources   Download

MIT

The Requires