Download the PHP package landao/webman-core without Composer
On this page you can find all versions of the php package landao/webman-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download landao/webman-core
More information about landao/webman-core
Files in landao/webman-core
Download landao/webman-core
More information about landao/webman-core
Files in landao/webman-core
Vendor landao
Package webman-core
Short Description Webman plugin landao/webman-core
License MIT
Homepage https://qilindao.github.io/docs/
Package webman-core
Short Description Webman plugin landao/webman-core
License MIT
Homepage https://qilindao.github.io/docs/
Please rate this library. Is it a good library?
Informations about the package webman-core
landao/webman-core 使用指南
- landao/webman-core 已实现的模块有 路由注解、验证器注解、数据迁移、数据填充、枚举注解、命令生(model, migrate, seeder,validate,enum,Repository,)。
1、环境和安装
- 在使用扩展前,先安装
composer require webman/console
1.1. 环境要求
- 由于使用了PHP8.1和枚举特性,因此PHP版本最低要求 >= 8.1,框架版本使用的是 webman1.6.x (webman1.6.x 中文文档)
2、注解使用
- 框架使用注解,需要先在
config/plugin.php中开启landao/webman-core插件config/plugin/landao.webman-core.app
2.1. 路由注解
- 在控制器中使用以下注解,快速创建一条路由
Tips: 需要 plugin.landao.webman-core.app.annotation.route.enable 开启 和 plugin.landao.webman-core.app.annotation.route.directories 扫描路径,否则将被排除扫描
2.2 验证器
2.2.1. 使用Validation注解快速开启一个验证器
2.2.1. 创建验证器类
不支持 unique、exists 等
3 数据迁移
3.1. 生成数据迁移文件
- fields 选项允许你指定表的字段结构
- plain 选项是一个布尔值选项,用于创建一个空白的迁移文件,不包含任何预设的表结构。当你需要编写一些特殊的数据库操作时,这个选项很有用。
3.2. 执行数据迁移
3.3. 执行数据回滚迁移
4、数据填充
4.1. 生成数据填充文件
Tips: 首次使用seeder,请手动创建 DatabaseSeeder 基础数据填充类
4.2.执行数据填充
5、命令生成文件
5.1 生成枚举文件
生成枚举类名自动追加后缀
Enum
5.2 生成 Repository
注意:该命令会附带生成对应的 Model,生成类名自动追加后缀
Repo
5.3 生成 Model
注意:该命令生成类名自动追加后缀
Model
5.4 生成验证器
注意:该命令生成类名自动追加后缀
Request,注解使用:#[Validation(class: UserRequest::class)]
6、Exception 异常
6.1 异常接管
配置 config/exception.php
插件配置,例如:/plugin/system/config/exception.php
6.2 输出错误信息
配置 config/app.php 开启调试模式
不开启调试,返回
6.3 自定义业务错误码
返回数据
6.4 统一业务异常处理,api直接返回
异常枚举定义
替换消息中的占位符,支持 {} 或 {0}, {1} 等格式
抛出异常使用例子
7、枚举注解、枚举转换
方法:
static getMap(): 获取所有枚举键值对static getKeys(): 获取所有枚举键static getValues(): 获取所有枚举值static include(string $value): bool: 检查键是否存在static includeAll(array $names): bool: 检查多个键是否存在equal(): 判断持久层返回的值是否相同getEnumLabel(): stirng: 获取枚举注解说明static getEnumMapLabel(): array: 获取枚举值和注解说明数组static hasValue(mixed $value): bool: 判断值是否包含在枚举value中static hasAllValues(array $values): bool: 判断多个值是否都包含在枚举value中equals(self $enum): bool: 比较两个枚举实例是否相同valueEquals(mixed $value): bool: 比较枚举值是否与给定值相同 使用示例:
8、注解脱敏
All versions of webman-core with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
ext-bcmath Version *
ext-openssl Version *
ext-json Version *
webman/console Version ^2.1
webman/database Version ^2.1
webman/redis Version ^2.1
webman/cache Version ^2.1
illuminate/pagination Version ^10.0 || ^11.0 || ^12.0
illuminate/events Version ^10.0 || ^11.0 || ^12.0
illuminate/validation Version ^10.0 || ^11.0 || ^12.0
symfony/var-dumper Version ^7.2
symfony/finder Version ^7.2
guzzlehttp/guzzle Version ^7.9
tinywan/jwt Version ^1.2
ext-bcmath Version *
ext-openssl Version *
ext-json Version *
webman/console Version ^2.1
webman/database Version ^2.1
webman/redis Version ^2.1
webman/cache Version ^2.1
illuminate/pagination Version ^10.0 || ^11.0 || ^12.0
illuminate/events Version ^10.0 || ^11.0 || ^12.0
illuminate/validation Version ^10.0 || ^11.0 || ^12.0
symfony/var-dumper Version ^7.2
symfony/finder Version ^7.2
guzzlehttp/guzzle Version ^7.9
tinywan/jwt Version ^1.2
The package landao/webman-core contains the following files
Loading the files please wait ...