PECL AOP interceptor
Interceptor using PECL AOP extension for PHP AOP.io lib (php-aop)., (*1)
Provides an abstraction layer of 'PECL AOP extension',
with many features to go further in the handling of the AOP with PHP.
Beyond the possibilities of the PECL extension., (*2)
This package is an adapter for PHP AOP.io lib (an abstraction layer easy to use). The doc below assumes that you have already installed the PHP AOP.io lib., (*3)
Getting Started
Install PECL AOP
You can use pecl, (*4)
sudo pecl install aop-beta
or, (*5)
Download the AOP PHP extension from github, compile and add the extension to your php.ini, (*6)
#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
Now you can add the following line to your php.ini to enables AOP extension, (*7)
extension=AOP.so
More doc on PECL AOP repository., (*8)
Install pecl-aop-interceptor
Download pecl-aop-interceptor (and configure your autoloader) or use composer require: "aop-io/pecl-aop-interceptor"
., (*9)
Usage
use Aop\Aop;
// Init
$aop = new Aop([ 'php_interceptor' => '\PeclAop\PeclAopInterceptor']);
The PECL AOP extension support the wilcard selector, example:, (*10)
Aop::addBefore('MyClass::get*()', function($jp) {
// your hack here
});
The syntax of pointcuts selectors of PECL AOP extension is documented on the page PECL AOP (pointcuts syntax)., (*11)
The usage of the AOP abstraction layer is documented on AOP.io., (*12)
License
MIT (c) 2013, Nicolas Tallefourtane., (*13)
Author