nuffic / yii2-docblock-form
该软件包最新版本(1.3.0)没有提供许可证信息。
将类属性文档块转换为表单
1.3.0
2021-10-20 11:45 UTC
Requires
- php: >=7.2
- phpdocumentor/reflection-docblock: ^5.0
- yiisoft/yii2: ^2.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-20 18:08:50 UTC
README
类定义
class Person { /** * @input * @validator {"class": "\\yii\\validators\\RequiredValidator"} * @validator {"class": "\\yii\\validators\\StringValidator", "min": 3, "max": 30} */ public $name; /** * @input widget["kartik\\switchinput\\SwitchInput", {"template": "default"}] * @input {"class": \\yii\\validators\\BooleanValidator", "skipOnEmpty": false} */ public $age; }
表单渲染
$form = ActiveForm::begin(); echo \nuffic\docblock\widget\Configure::widget([ 'form' => $form, 'reflection' => new \nuffic\docblockReflectionBuilder(Person::class), ]); $form->end();