nuffic/yii2-docblock-form

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

Makes a form out of class property docblocks

Installs: 3 084

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 4

Open Issues: 0

Type:yii2-extension

1.4.0 2024-10-14 08:28 UTC

This package is auto-updated.

Last update: 2024-12-14 08:47:27 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();