letscodehu/php-dynamic-proxy
Composer 安装命令:
composer require letscodehu/php-dynamic-proxy
包简介
A dynamic proxy generator for PHP
README 文档
README
A dynamic proxy generator for PHP.
Based on Javassist ProxyFactory
Usage
Config::set(["CACHE_DIRECTORY" => "/tmp/php-dynamic-proxy"]); $class = new ReflectionClass("Class"); $methodOverrides = [ new MethodHook { public function supports(ReflectionMethod $method) { return $method->getName() == "test"; } public function invoke($proxy, ReflectionMethod $method, array $args) { // before original method $returnValue = $method->invokeArgs($proxy, $args); // after original method return $returnValue; } } ]; $proxy = ProxyFactory::create($class, $methodOverrides);
统计信息
- 总下载量: 84
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-18