aop-io / pecl-aop-interceptor
PHP-AOP 代码拦截器,基于 AOP PHP 扩展(pecl aop-beta)。提供 PHP 扩展 'PECL AOP' 的抽象层,具有许多特性以进一步处理 PHP 中的 AOP。
v0.1
2014-08-14 14:40 UTC
Requires
- php: >=5.4
This package is auto-updated.
Last update: 2024-09-05 22:49:47 UTC
README
使用 PECL AOP 扩展(AOP-PHP)和 PHP AOP.io 库(php-aop)编写的拦截器。
提供 'PECL AOP 扩展' 的抽象层,具有许多特性以进一步处理 PHP 中的 AOP。超出 PECL 扩展的可能性。
本包是 PHP AOP.io 库(一个易于使用的抽象层)的适配器。以下文档假设您已安装了 PHP AOP.io 库。
入门
安装 PECL AOP
您可以使用 pecl
sudo pecl install aop-beta
或
从 github 下载 AOP PHP 扩展,编译并将扩展添加到您的 php.ini
#Clone the repository on your computer git clone https://github.com/AOP-PHP/AOP cd AOP #prepare the package, you will need to have development tools for php phpize #compile the package ./configure make #before the installation, check that it works properly make test #install make install
现在您可以将以下行添加到您的 php.ini 以启用 AOP 扩展
extension=AOP.so
有关 PECL AOP 存储库的更多文档 PECL AOP repository。
安装 pecl-aop-interceptor
下载 pecl-aop-interceptor(并配置您的自动加载器)或使用 composer require: "aop-io/pecl-aop-interceptor"
。
使用方法
use Aop\Aop; // Init $aop = new Aop([ 'php_interceptor' => '\PeclAop\PeclAopInterceptor']);
PECL AOP 扩展支持通配符选择器,例如
Aop::addBefore('MyClass::get*()', function($jp) { // your hack here });
PECL AOP 扩展的切点选择器语法在页面 PECL AOP (pointcuts syntax) 上有文档说明。
AOP 抽象层的使用在 AOP.io 上有文档说明。
许可证
MIT (c) 2013, Nicolas Tallefourtane。