nuffic / yii2-docblock-form
Makes a form out of class property docblocks
Installs: 2 997
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 4
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.2
- phpdocumentor/reflection-docblock: ^5.0
- yiisoft/yii2: ^2.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-14 08:43:18 UTC
README
Class definition
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 rendering
$form = ActiveForm::begin(); echo \nuffic\docblock\widget\Configure::widget([ 'form' => $form, 'reflection' => new \nuffic\docblockReflectionBuilder(Person::class), ]); $form->end();