# ctl-param-generator-4-laravel **Repository Path**: vijay_0215/ctl-param-generator-4-laravel ## Basic Information - **Project Name**: ctl-param-generator-4-laravel - **Description**: 控制器生成参数的laravel适配嘎嘎 - **Primary Language**: PHP - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-18 - **Last Updated**: 2024-02-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 控制器参数生成器 Laravel 适配器 ## 介绍 通过注解的形式直接生成控制器参数 ## 安装 ```shell composer require dreamcat/ctl-param-generator-4-laravel ``` ## 使用方法 ### 加入 provider - `\DreamCat\ControllerParamGen4Laravel\Provider\CtlParamGenProvider` ### 配置定义 配置文件放在 `config/controllerParamGenerator.php` 配置路径 | 类型 | 含义 | 默认值 --- | --- | --- | --- arrayConverter.createNewProperty | bool | 生成参数时是否创建对象原本不存在的属性 | false arrayConverter.tryWithoutConstructor | bool | 如果参数的类无法调用构造函数时是否尝试执行不调用构造函数创建对象 | false arrayConverter.tryCallSetter | bool | 如果属性有set方法是否尝试调用 | true arrayConverter.tryConstructWithParam | bool | 如果构造函数仅有一个必填参数,尝试在构造函数只有一个参数时调用构造函数 | true arrayConverter.propertyAnalysis | string | 属性分析器的bean名类名,必须实现接口 `\Dreamcat\PropertyAnalysis\PropertyAnalysisInterface` 才有效 | null bodyDecoders | string[] | 特定content-type的消息解码器,必须实现接口 `\DreamCat\ControllerParamGen\HttpBodyDecodeInterface` | null specParams | Map | 特殊类的构造器,键是类名,值是对应的bean,必须实现接口 `\DreamCat\ControllerParamGen\ParamCreateInterface` | null jsonCoder.transMode | 0 / 1 / 2 | `1` 表示会自动将对象的驼峰风格与参数的下划线风格互相映射, `2` 表示会自动将对象的下划线风格与参数的驼峰风格互相映射 | 0 jsonCoder.ignoreUndefine | bool | 对响应对象中未赋值的字段是否不做输出 | true