PHP code example of lisachenko / go-aop-php

1. Go to this page and download the library: Download lisachenko/go-aop-php 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/ */

    

lisachenko / go-aop-php example snippets

 php

// app/ApplicationAspectKernel.php

use Go\Core\AspectKernel;
use Go\Core\AspectContainer;

/**
 * Application Aspect Kernel
 */
class ApplicationAspectKernel extends AspectKernel
{

    /**
     * Configure an AspectContainer with advisors, aspects and pointcuts
     *
     * @param AspectContainer $container
     *
     * @return void
     */
    protected function configureAop(AspectContainer $container)
    {
    }
}
 php
// front-controller, for Symfony2 application it's web/app_dev.php

 = ApplicationAspectKernel::getInstance();
$applicationAspectKernel->init([
        'debug'        => true, // use 'false' for production mode
        'appDir'       => __DIR__ . '/..', // Application root directory
        'cacheDir'     => __DIR__ . '/path/to/cache/for/aop', // Cache directory
        // Include paths restricts the directories where aspects should be applied, or empty for all source files
        '
 php
// app/ApplicationAspectKernel.php

use Aspect\MonitorAspect;

//...

    protected function configureAop(AspectContainer $container)
    {
        $container->registerAspect(new MonitorAspect());
    }

//...