PHP code example of zlikavac32 / php-enum-symfony

1. Go to this page and download the library: Download zlikavac32/php-enum-symfony library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zlikavac32 / php-enum-symfony example snippets


use \Zlikavac32\SymfonyEnum\Form\Type\EnumType;

class FormModel
{
    public $answer;
    
    // ...
}

$formModel = new FormModel();

$form = $this->createFormBuilder($formModel)
    ->add('answer', EnumType::class, [
        'enum_class' => \YesNoEnum::class
    ])
    // ...
    ->getForm();

/**
 * @ValidEnumElement(enumClass="\YesNoEnum")
 */

composer