PHP code example of maddoger / yii2-select2

1. Go to this page and download the library: Download maddoger/yii2-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/ */

    

maddoger / yii2-select2 example snippets


use maddoger\widgets\Select2;

echo $form->field($model, 'field')->widget(Select2::className(), [
    'options' => [
        'multiple' => true,
        'placeholder' => 'Choose item'
    ],
    'clientOptions' => [
        'width' => '100%',
    ],
    'items' => [
        'item1',
        'item2',
        ...
    ]
]);

php composer.phar