mascame/hooky

1.1.0 2016-11-01 21:20 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:31:25 UTC


README

Packagist Travis license

简单的钩子。

安装

composer require mascame/hooky

使用

MyHook.php

class MyHook implements \Mascame\Hooky\HookContract {

    public function handle($data, $next)
    {
        $data = 'test';

        return $next($data);
    }
    
}

somewhere.php

$hook = new \Mascame\Hooky\Hook();
$hookName = 'bar';
$someData = 'foo'; // This will be sent to handlers, where they can manipulate it

$hook->to($hookName, [MyHook::class, AnotherHook::class]);

$data = $hook->fire($hookName, $someData);

贡献

感谢您考虑贡献!您可以在任何时间通过fork项目并提交pull request来贡献。

支持

如果您需要帮助或任何形式的支持,请发送电子邮件至Marc Mascarell,邮箱地址为marcmascarell@gmail.com

许可证

MIT