PHPackages                             eeliu/php\_simple\_aop - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. eeliu/php\_simple\_aop

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

eeliu/php\_simple\_aop
======================

A simple Aop library via php-parse

v1.0.0(5y ago)41.6k1BSD-3-ClausePHP

Since Aug 13Pushed 5y agoCompare

[ Source](https://github.com/eeliu/php_simple_aop)[ Packagist](https://packagist.org/packages/eeliu/php_simple_aop)[ RSS](/packages/eeliu-php-simple-aop/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (8)Dependencies (2)Versions (20)Used By (0)

This repository had migrated to naver/php-simple-aop, please goto [naver/php-simple-aop](https://github.com/naver/php-simple-aop) for the latest.
-------------------------------------------------------------------------------------------------------------------------------------------------

[](#this-repository-had-migrated-to-naverphp-simple-aop-please-goto-naverphp-simple-aop-for-the-latest)

NOT `UPDATE` ANY MORE

[![Build Status](https://camo.githubusercontent.com/edebf6bd7bd95869edf1b28c62210653f3110fb16779f06b9aaba6ecf22e86a7/68747470733a2f2f7472617669732d63692e636f6d2f65656c69752f7068705f73696d706c655f616f702e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/eeliu/php_simple_aop)

How to Use
----------

[](#how-to-use)

### Import from packagist

[](#import-from-packagist)

Change configuration file in PHP/pinpoint\_php\_example/composer.json

```
    "require": {
        "eeliu/php_simple_aop": "v0.2.4"
    }
```

### Write your plugins

[](#write-your-plugins)

This is a plugin template for reference.

```
/// 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){
    }
}
```

> Example

[https://github.com/naver/pinpoint-c-agent/tree/v0.2.2/PHP/pinpoint\_php\_example/Plugins](https://github.com/naver/pinpoint-c-agent/tree/v0.2.2/PHP/pinpoint_php_example/Plugins)

### Activate plugins

[](#activate-plugins)

This could be found in PHP/pinpoint\_php\_example/app/index.php.

```
