https://github.com/we7coreteam/w7-rangine-aspect
https://github.com/we7coreteam/w7-rangine-aspect
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/we7coreteam/w7-rangine-aspect
- Owner: we7coreteam
- License: apache-2.0
- Created: 2021-07-20T02:40:55.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-02-17T11:07:11.000Z (over 4 years ago)
- Last Synced: 2024-12-10T03:26:19.159Z (over 1 year ago)
- Language: PHP
- Size: 68.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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());
```