nuffic/yii2-docblock-form

There is no license information available for the latest version (1.3.0) of this package.

Makes a form out of class property docblocks

Installs: 2 449

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 3

Open Issues: 0

Type:yii2-extension

1.3.0 2021-10-20 11:45 UTC

This package is auto-updated.

Last update: 2024-04-20 17:22:55 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();