ltsc / iaop
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ltsc/iaop
Requires (Dev)
- phpunit/phpunit: ^8.1
This package is auto-updated.
Last update: 2025-10-19 21:57:53 UTC
README
Usage
- Method 1
//Your class instance $myObj = new MyObj(); //You can add one $before and one $after there, //or add after $demo = new AOP($myObj); $demo->addBefore(function($method, $arguments) { //do something //$method and $arguments recv the method(argument[]) }); $demo->addAfter(function($result, $method, $arguments) { //do something //$result recv the return of method(argument[]) }); $demo->myFunc(...something...);
-
Method 2
You can just write your class that extends the AOP class, then you can get IDE's automatic prompt.
Standard
$before and $after must return a bool.
thrown
-
AopException- When
setoraddsomething failed; - When the
myFuncin$myObjnot exists.
- When
-
CallException- When any callback of $before or $after return false