1. Go to this page and download the library: Download eeliu/php_simple_aop library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eeliu / php_simple_aop example snippets
/// Placing "///@hook:" here: aop on function(method) on before,end and Exception
///@hook:app\AppDate::output
class CommonPlugin
{
//$apId: The function(method) name
//$who: If watching a method, $who is that instance
//$args: array parameters $argv = $args[0]
public function __construct($apId,$who,&...$args){
// $this->argv = $args[0];
// $this->funName =$apId;
// $this->instance = $who;
}
// watching before
///@hook:app\DBcontrol::connectDb
public function onBefore(){
}
// watching after
///@hook:app\DBcontrol::getData1 app\DBcontrol::\array_push
public function onEnd(&$ret){
}
// Exception
///@hook:app\DBcontrol::getData2
public function onException($e){
}
}
php
able path for caching AOP code
define('AOP_CACHE_DIR',__DIR__.'/Cache/');
// Your plugins directory: All plugins must have a suffix "Plugin.php",as "CommonPlugin.php mysqlPlugin.php RPCPlugin.php"
define('PLUGINS_DIR',__DIR__.'/../Plugins/');
// since 0.2.3 supports user filter when loadering a class.
// define('USER_DEFINED_CLASS_MAP_IMPLEMENT','\Plugins\ClassMapInFile.php');
// Use php_simple_aop auto_pinpointed.php instead of vendor/autoload.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.