承接 subzerobo/sabalim-action-wrapper 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

subzerobo/sabalim-action-wrapper

最新稳定版本:v1.0.2

Composer 安装命令:

composer require subzerobo/sabalim-action-wrapper

包简介

Action Wrapper Library for Before/After action handling

README 文档

README

Action Wrapper Library for Before/After Specific action handling, this library provides the abstraction layer for other libraries specially for Sabalim-Elastic-Apm-PHP-Agent.

HandlerInterface

Interface provides two functions which whould run before and after any specific action

interface HandlerInterface{
    public function handleBefore($parent, string $actionName, array $actionData = []); 
    public function handleAfter($parent, string $actionName, array $actionData = []);
}

$parent is your main object which it's action(s) need to be wrapped for example you can pass the redis object $actionName is the context of the action you are trying to wrap $actionData is the extra data you whould like to pass to the wrapper

HandlerAbstract

HandlerAbstract class implements the HandlerInterface and does claculate the action event duration by default but you can pass the start and end microtime to override the default implemented code

It has the built-in DataStore to save the extra parameters passed in handleBefore to be used later in handlerAfter method.

Your custom handlers may extend this class.

class myCustomHandler extends HandlerAbstract
{
 	private $your_custom_private;
 	public $your_custom_public;

    public function handleBefore($request, string $actionName, array $actionData = [])  
    {  
	      parent::handleBefore($request, $actionName, $actionData);  
	      // Your code ...
    }
	public function handleAfter($request, string $actionName, array $actionData = [])  
	{  
		      parent::handleAfter($request, $actionName, $actionData);  
		      // Your code ...
	}
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-25