An Hydrator class that can be used for filling object from array and extracting data from objects back to arrays.

Related tags

Frameworks hydrator
Overview

Hydrator

namespace: Meow\Hydrator

Library that can hydrate (fill object with data from array) and extract data from object back to array.

Installation

To install this library into your project use composer script:

composer require meow/hydrator

Usage

Hydrate

Filling object from array

protected array $testModelData = [
    "name" => "May",
    'email' => '[email protected]'
];
// ...
$hydrator = new Hydrator();
$testModel = $hydrator->hydrate(TestModel::class, $this->testModelData);

Extract

Extraction properties and their values back to the array.

$testModelDataArray = $hydrator->extract($testModel, ['name', 'email']);

License: MIT

You might also like...
PHP Kafka client is used in PHP-FPM and Swoole. PHP Kafka client supports 50 APIs, which might be one that supports the most message types ever.

longlang/phpkafka Introduction English | 简体中文 PHP Kafka client is used in PHP-FPM and Swoole. The communication protocol is based on the JSON file in

PropertyInfo extracts information about PHP class' properties using metadata of popular sources.

PropertyInfo Component The PropertyInfo component extracts information about PHP class' properties using metadata of popular sources. Resources Docume

Basic PHP app with Composer used in Microsoft Docs examples

page_type languages products description urlFragment sample php azure This sample demonstrates a tiny PHP app with Composer. php-basic-composer PHP sm

Framework used for most of my PHP projects.

PHP boilerplate code that most of my php projects share. Requires php: =7.3 ext-json: * ext-pdo: * ext-phalcon: =4.0.0 ext-posix: * ext-

Yii2 console application used to write our processors of methods to responsible to client calling.

Microservice Application Skeleton Yii2 console application used to write our processors of methods to responsible to client calling. This application

Strict PSR-7 implementation used by the Slim Framework

Strict PSR-7 implementation used by the Slim Framework, but you may use it separately with any framework compatible with the PSR-7 standard.

SecLists is the security tester's companion. It's a collection of multiple types of lists used during security assessments
SecLists is the security tester's companion. It's a collection of multiple types of lists used during security assessments

SecLists is the security tester's companion. It's a collection of multiple types of lists used during security assessments, collected in one place. List types include usernames, passwords, URLs, sensitive data patterns, fuzzing payloads, web shells, and many more. The goal is to enable a security tester to pull this repository onto a new testing box and have access to every type of list that may be needed.

A simple class that provides access to country & state list.

GeoData A simple class that provides access to country & state list. Installation composer require ahmard/geodata Usage Fetch country list ?php use

a framework for WebDevelop based on the mvc structure. The name of this project for Fun because everyone can use it. Completely simple and powerful structure for all your projects

A_A (-.-) ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ |-| █▄─▄▄─█▄─██─▄█─▄▄▄▄█─▄▄▄▄█▄─█─▄█─▄▄▄─██▀▄─██─▄

Releases(v1.0.2)
  • v1.0.2(Apr 28, 2022)

    What's Changed

    • Updated hydrator to check if class has property by @MayMeow in https://github.com/meowphp/hydrator/pull/1
    • Added tests for not existing field in target property by @MayMeow in https://github.com/meowphp/hydrator/pull/2
    • Updated Hydrator to allow null in json strings by @MayMeow in https://github.com/meowphp/hydrator/pull/3

    New Contributors

    • @MayMeow made their first contribution in https://github.com/meowphp/hydrator/pull/1

    Full Changelog: https://github.com/meowphp/hydrator/compare/v1.0.1...v1.0.2

    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Nov 14, 2021)

  • v1.0.0(Nov 14, 2021)

Owner
Meow
PHP libraries
Meow
TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs.

TrailLamp Introduction TrailLamp is a lightweight, easy-to-use Php MVC framework that can be used to build web applications and REST APIs. Installatio

Etorojah Okon 14 Jun 10, 2022
The component provides an array-based DSL to construct complex validation chains.

Spiral Validator The component provides an array-based DSL to construct complex validation chains. Requirements Make sure that your server is configur

Spiral Scout 2 Sep 14, 2022
JShrink is a php class that minifies javascript so that it can be delivered to the client quicker

JShrink JShrink is a php class that minifies javascript so that it can be delivered to the client quicker. This code can be used by any product lookin

Tedious Developments 677 Nov 16, 2022
Hamtaro - the new web framework for front-end / back-end development using Php and Javascript.

Hamtaro framework About Technologies Controllers Components Commands Front-end development Getting Started About Hamtaro is the new web framework for

Phil'dy Jocelyn Belcou 3 May 14, 2022
BEdita, ready to use back-end API, extensible API-first Content Management

BEdita, a back-end API BEdita 4 is a ready to use back-end API to handle the data of your mobile, IoT, web and desktop applications. It's also an exte

BEdita 65 Oct 31, 2022
With this extension you can share data from your web pages to any social network!

Extension for sharing on social networks With this extension you can share data from your web pages to any social network! Features: SEO support, defa

Yii Maker 50 Oct 15, 2022
A easy way to install your basic yii projetc, we have encrypt database password in phpfile, my class with alot funtions to help you encrypt and decrypt and our swoole server install just run ./yii swoole/start and be happy!

Yii 2 Basic Project Template with swoole and Modules Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small proj

null 3 Apr 11, 2022
The package provides definition syntax. Definition is describing a way to create and configure a service or an object.

Yii Definitions The package ... Requirements PHP 7.4 or higher. Installation The package could be installed with composer: composer require yiisoft/de

Yii Software 6 Jul 15, 2022
A set of PSR-7 object decorators providing useful convenience methods

Slim-Http Slim PSR-7 Object Decorators Installation It's recommended that you use Composer to install this library. $ composer require slim/http This

Slim Framework 136 Sep 29, 2022