2017 © Pedro Peláez
 

library php-aop

Implements a simplified subset of AOP pragmatism and provides the AOP (Aspect Oriented Programming) features for PHP.

image

aop-io/php-aop

Implements a simplified subset of AOP pragmatism and provides the AOP (Aspect Oriented Programming) features for PHP.

  • Friday, August 15, 2014
  • by Nicolab
  • Repository
  • 3 Watchers
  • 17 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

AOP for PHP

Implements a simplified subset of AOP (Aspect Oriented Programming) pragmatism and provides the AOP features for PHP application., (*1)

Only one dependency, the code interceptor., (*2)

The PHP lib of AOP.io provides an abstraction layer easy to use for AOP development, so it can work with several PHP code interceptors., (*3)

The first interceptor implemented uses PECL AOP-PHP extension., (*4)

Other interceptors are planned. If you want to create an interceptor, see the skeleton., (*5)

Getting Started

Install

1) Install an interceptor, e.g: PECL AOP-PHP extension., (*6)

2) Download PHP AOP.io lib (and configure your autoloader) or use composer require: "aop-io/php-aop"., (*7)

Usage

use Aop\Aop;

// Init
new Aop();

function hello($name)
{
    return $name
}

// Interception of kind 'around'
Aop::addAround('hello()', function($joinPoint) {

    // In this context,
    // $joinPoint is an instance of \Aop\JoinPoint\AroundFunctionJoinPoint

    // get an array with all arguments values
    var_dump($joinPoint->getArgs()); // (array) 0 => World !

    // change the return value
    $joinPoint->setReturnValue('Hello Nico !');

    // Proceed the execution of the function ( hello() )
    $joinPoint->proceed();
});

echo hello('World !'); // Hello Nico !

License

MIT (c) 2013, Nicolas Tallefourtane., (*8)

Author

Nicolas Tallefourtane - Nicolab.net
Nicolas Talle
Make a donation via Paypal

The Versions

15/08 2014

dev-master

9999999-dev http://aop.io

Implements a simplified subset of AOP pragmatism and provides the AOP (Aspect Oriented Programming) features for PHP.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

event ioc injection lib aop patch monkey interceptor

14/08 2014

v0.1

0.1.0.0 http://aop.io

Implements a simplified subset of AOP pragmatism and provides the AOP (Aspect Oriented Programming) features for PHP.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

event ioc injection lib aop patch monkey interceptor