PHPackages                             next/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. next/aop

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

next/aop
========

An AOP package that is resident in in-memory PHP frameworks, such as nextphp, WebMan.

0.2.4(4mo ago)10351Apache-2.0PHPPHP ^8.2

Since May 24Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/next-laboratory/aop)[ Packagist](https://packagist.org/packages/next/aop)[ Docs](https://github.com/next-laboratory/aop)[ RSS](/packages/next-aop/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (1)

！！！ 不能生产使用，仅作为研究用途
==================

[](#-不能生产使用仅作为研究用途)

一款简单Aop实现。支持常驻内存型PHP应用。可以方便接入nextphp, Swoole，WebMan等框架。

环境要求
====

[](#环境要求)

```
php 8.2
开启passthru函数

```

安装
==

[](#安装)

```
composer require next/aop
```

使用，以下以webman为例
==============

[](#使用以下以webman为例)

修改start.php文件
-------------

[](#修改startphp文件)

```
Aop::init(
    [__DIR__ . '/../app'],
    [
        \Next\Aop\Collector\PropertyAttributeCollector::class,
        \Next\Aop\Collector\AspectCollector::class,
    ],
    __DIR__ . '/../runtime/aop',
);
```

- paths 注解扫描路径
- collectors 注解收集器
    - \\Next\\Aop\\Collector\\AspectCollector::class 切面收集器，取消后不能使用切面
    - \\Next\\Aop\\Collector\\PropertyAttributeCollector::class 属性注解收集器，取消后不支持属性自动注入
- runtimeDir 运行时，生成的代理类和代理类地图会被缓存到这里

编写切面类，实现AspectInterface接口
-------------------------

[](#编写切面类实现aspectinterface接口)

```
