limingxinleo/aop-integration

This package is abandoned and no longer maintained. No replacement package was suggested.

AopIntegration

v1.0.1 2020-12-19 07:48 UTC

This package is auto-updated.

Last update: 2021-01-20 05:25:45 UTC


README

本组件不再维护,请使用 hyperf/aop-integration

安装

composer require limingxinleo/aop-integration

配置 AOP 到 ThinkPHP 框架

  1. 添加配置到 config/config.php
<?php

declare(strict_types=1);

! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));

return [
    'annotations' => [
        'scan' => [
            'paths' => [
                BASE_PATH . '/app',
            ],
            'ignore_annotations' => [
                'mixin',
            ],
            'class_map' => [
            ],
        ],
    ],
    'aspects' => [
        // 在此配置可用的 Aspect
    ],
];
  1. 修改入口文件
<?php

declare(strict_types=1);

namespace think;

use Hyperf\AopIntegration\ClassLoader;

require __DIR__ . '/../vendor/autoload.php';

// 初始化 AOP
! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));

ClassLoader::init();

// 省略其他代码