axy/callbacks
Composer 安装命令:
composer require axy/callbacks
包简介
Extension of php-callback format
README 文档
README
- The library does not require any dependencies.
- Tested on PHP 5.4+, PHP 7, HHVM (on Linux), PHP 5.5 (on Windows).
- Install:
composer require axy/callbacks. - License: MIT.
Documentation
Examples
function sum($a, $b) { return $a + $b; }
Standard callback:
$callback = new Callback('sum'); echo $callback(2, 2);
Binging arguments:
$callback = new Callback('sum', [3]); echo $callback(4); // 3 + 4 = 7
Binging context:
class MyClass { public function getEventHandler() { return new Callback([$this, 'onEvent'], ['click'], true); } private function onEvent($event) { echo 'Event '.$event.'!'; } } $obj = new MyClass(); $handler = $obj->getEventHandler(); // click $handler(); // "Event click!". Private method was called
统计信息
- 总下载量: 460
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-12-26