PHPackages                             landao/webman-core - 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. [Database &amp; ORM](/categories/database)
4. /
5. landao/webman-core

ActiveLibrary[Database &amp; ORM](/categories/database)

landao/webman-core
==================

Webman plugin landao/webman-core

v1.0.6(9mo ago)118MITPHPPHP ^8.2

Since Feb 14Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/Joycezhangw/webman-core)[ Packagist](https://packagist.org/packages/landao/webman-core)[ Docs](https://qilindao.github.io/docs/)[ RSS](/packages/landao-webman-core/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (11)Versions (8)Used By (0)

landao/webman-core 使用指南
=======================

[](#landaowebman-core-使用指南)

- landao/webman-core 已实现的模块有 路由注解、验证器注解、数据迁移、数据填充、枚举注解、命令生(model, migrate, seeder,validate,enum,Repository,)。

1、环境和安装
-------

[](#1环境和安装)

- 在使用扩展前，先安装 `composer require webman/console`

### 1.1. 环境要求

[](#11-环境要求)

- 由于使用了[PHP8.1和枚举特性](https://www.php.net/releases/8.1/en.php)，因此PHP版本最低要求 &gt;= 8.1，框架版本使用的是 webman1.6.x ([webman1.6.x 中文文档](https://www.workerman.net/doc/webman/README.html))

2、注解使用
------

[](#2注解使用)

- 框架使用注解，需要先在 `config/plugin.php` 中开启 `landao/webman-core` 插件 `config/plugin/landao.webman-core.app`

```
//annotation.route
 "annotation" => [
    //路由注解
    'route' => [
        'enable' => true,
        // 扫描的目录
        'directories' => [
            app_path('controller') => [
            ],
            base_path('plugin/system/app/controller/admin') => [
                'prefix' => '/admin-api/system',// 路由前缀
                'as'=>'system:',// 路由别名
                'namespace' => 'plugin\system\app\controller\admin\\'// 控制器命名空间
            ]
        ],
    ],
],
```

### 2.1. 路由注解

[](#21-路由注解)

- 在控制器中使用以下注解，快速创建一条路由

> Tips: 需要 plugin.landao.webman-core.app.annotation.route.enable 开启 和 plugin.landao.webman-core.app.annotation.route.directories 扫描路径，否则将被排除扫描

```
