定制 dgifford/hooks-trait 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

dgifford/hooks-trait

Composer 安装命令:

composer require dgifford/hooks-trait

包简介

Trait providing methods for creating hooks.

README 文档

README

Adds the methods required to use hooks in a class, similar to how functions can be hooked into Wordpress.

Usage

Add a `use` statement at the start of the class to include the trait.

class Foo
{
	Use dgifford\Traits\HooksTrait;
}

The `doHook` method adds a hook into the class. This method requires a name for the hook and a variable that the hook will act on.

$value = $this->doHook('my_hook_name', $value );

Additional arguments can be provided if hooked in functions require them.

$value = $this->doHook('my_hook_name', $value, $arguments );

Callbacks can then be hooked into the class with the `addHook` method, which accepts the hook name and a callable, such as a closure.

$foo->addHook( 'my_hook_name', function( $value, $arguments ) { return $value + 1; } );

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2017-02-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固