Skip to content

mvaliolahi/hyrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Hydrator

Install

composer require mvaliolahi/hydrate

Example

$hydrate = new Hydrate();

/**
 * @var PostDTO
 */
$post = $hydrate->to(PostDTO::class, [
  'title' => 'Test',
  'description' =>  'sample post'
]);
  • Tip: third argument of to() method can be use to overwrite data.

todo

- cast some fields to specefic object after hydrate.
- add toArray method.