Go! - PHP的OOP&AOP框架

jopen 12年前

Go!是一个PHP 5.4库,基于OOP和AOP模式。它能够让开发者为每一个PHP应用程序添加AOP支持。需 PECL 扩展、Runkit、evals 或者 DI 容器支持。可使用 XDebug 轻松调试。

Go! - PHP的OOP&AOP框架
示例代码:

// Aspect/MonitorAspect.php    namespace Aspect;    use Go\Aop\Aspect;  use Go\Aop\Intercept\FieldAccess;  use Go\Aop\Intercept\MethodInvocation;  use Go\Lang\Annotation\After;  use Go\Lang\Annotation\Before;  use Go\Lang\Annotation\Around;  use Go\Lang\Annotation\Pointcut;    /**   * Monitor aspect   */  class MonitorAspect implements Aspect  {        /**       * Method that will be called before real method       *       * @param MethodInvocation $invocation Invocation       * @Before("execution(public Example->*(*))")       */      public function beforeMethodExecution(MethodInvocation $invocation)      {          $obj = $invocation->getThis();          echo 'Calling Before Interceptor for method: ',               is_object($obj) ? get_class($obj) : $obj,               $invocation->getMethod()->isStatic() ? '::' : '->',               $invocation->getMethod()->getName(),               '()',               ' with arguments: ',               json_encode($invocation->getArguments()),               "  \n";      }  }

项目主页:http://www.open-open.com/lib/view/home/1357808101527