PHP code example of n2ref / coreui-form-field-select2

1. Go to this page and download the library: Download n2ref/coreui-form-field-select2 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/ */

    

n2ref / coreui-form-field-select2 example snippets


$form = new Form();

$form->setRecord([
    'field' => 'Reactive',
]);

$options = [
    'Reactive',
    'Solution',
    'Conglomeration',
    'Algoritm',
    'Holistic',
];

$form->setFields([
    (new Field\Select2('field', 'title')))->setWidth(300)->setOptions($options)
        ->setSelect2([
            "placeholder"     => 'Write your value',
            "tags"            => true,
            "tokenSeparators" => [',', ' ']
        ]),
]);

echo json_encode($form->toArray());
shell
composer install n2ref/coreui-form-field-select2-php