PHP Class Cml\Plugin

Show file Open project: linhecheng/cmlphp Class Usage Examples

Public Methods

Method Description
hook ( string $hook, array $params = [] ) : mixed 执行插件
mount ( string $hook, array $params = [] ) 挂载插件到钩子 \Cml\Plugin::mount('hookName', [ function() {//匿名函数 }, '\App\Test\Plugins' => 'run' //对象, '\App\Test\Plugins::run'////静态方法 ]);

Method Details

hook() public static method

执行插件
public static hook ( string $hook, array $params = [] ) : mixed
$hook string 插件钩子名称
$params array 参数
return mixed

mount() public static method

挂载插件到钩子 \Cml\Plugin::mount('hookName', [ function() {//匿名函数 }, '\App\Test\Plugins' => 'run' //对象, '\App\Test\Plugins::run'////静态方法 ]);
public static mount ( string $hook, array $params = [] )
$hook string 要挂载的目标钩子
$params array 相应参数