An open API service indexing awesome lists of open source software.

https://github.com/we7coreteam/w7-rangine-aspect


https://github.com/we7coreteam/w7-rangine-aspect

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

## 安装

```
composer require w7/rangine-aspect
```

## 在rangine中使用

直接安装即可

## 在laravel中使用

直接安装即可。

### 编写Aspect

首先让我们编写待切入类

```php
[
'test',
'test1'
]
];

public function process(AspectJoinPoint $aspectJoinPoint, \Closure $next) {
var_dump('aspect before ' . $aspectJoinPoint->class . ':' . $aspectJoinPoint->method);

$result = $next($aspectJoinPoint);

var_dump('aspect after ' . $aspectJoinPoint->class . ':' . $aspectJoinPoint->method);

return $result;
}
}
```

### 生成代理类配置
rangine
```
bin/gerent aspect:build
```
laravel
```
php artisan aspect:build
```

使用
```php
(new TestAspectService())->test('woshishui');
var_dump((new TestAspectService())->test1());
var_dump((new TestAspectService())->test2());
```