mrkrstphr/hydrotron 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrkrstphr/hydrotron

Composer 安装命令:

composer require mrkrstphr/hydrotron

包简介

Hydrotron aids in hydrating PHP objects

README 文档

README

Hydrotron aids in hydrating PHP objects

Installation

composer install mrkrstphr/hydrotron

Usage

When an array key exists, call one or more callbacks:

$hydro = new Hydrotron(['foo' => 'bar']);
$hydro->when('foo', $callback, [$object, 'method']);

When an array key exists, instantiate an object, and call a series of callbacks with that object:

$hydro = new Hydrotron(['foo' => 'bar', 'bizz' => 'buzz']);
$hydro->instantiateWhen('foo', MyClass::class, $callback);

instantiateWhen() uses Instantiator, which will analyze the classes constructor arguments and pass the values of any keys within the Hydrotron array that matches those argument names.

So if MyClass looked like:

class MyClass {
    public function __construct($foo, $bizz) {}
}

MyClass would be instantiated with $foo = 'bar' and $bizz = 'buzz'. If an argument name is not found within the array, null will be passed.

Credits

Hydrotron was inspired by Keyper.

统计信息

  • 总下载量: 5.06k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固