aop-io/php-aop 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aop-io/php-aop

Composer 安装命令:

composer require aop-io/php-aop

包简介

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

README 文档

README

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

Only one dependency, the code interceptor.

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.

The first interceptor implemented uses PECL AOP-PHP extension.

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

Getting Started

Install

  1. Install an interceptor, e.g: PECL AOP-PHP extension.

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

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.

Author

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

统计信息

  • 总下载量: 45
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 22
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固