vestin/hook

1.0 2017-04-07 08:05 UTC

This package is auto-updated.

Last update: 2024-09-21 22:47:39 UTC


README

受以下启发创建的钩子库

安装

composer require vestin/hook

示例

namespace App;
use Vestin\Hook\Target;
class DoneTarget implement Target{
    public function exec(){
        echo 'bye';
    }
}
require 'vendor/autoload.php';
use Vestin\Hook\Hook;

Hook::on('init', function(){ echo 'hello'; });
Hook::on('done', 'App\DoneTarget');
/*
 * other code you need
*/
Hook::call('init'); // see 'hello';
Hook::call('done'); // see 'bye';

许可证

MIT