PHP code example of wdmg / yii2-tagsinput

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

    

wdmg / yii2-tagsinput example snippets


    
    use wdmg\widgets\TagsInput;
    ...
    
    echo TagsInput::widget([
        'model' => $model,
        'attribute' => 'post_tags',
        'options' => [
            'class' => 'form-control'
        ],
        'pluginOptions' => [
            'minInput' => 2,
            'maxTags' => 100
        ]
    ]);
    
    

    
    use wdmg\widgets\TagsInput;
    ...
    
    $form = ActiveForm::begin();
    ...
    
    echo $form->field($model, 'tags')->widget(TagsInput::class, [
        'options' => [
            'id' => 'post-tags',
            'class' => 'form-control',
            'placeholder' => 'Type your tags here...'
        ],
        'pluginOptions' => [
            'autocomplete' => '//example.com/api/',
            'format' => 'json',
            'minInput' => 2,
            'maxTags' => 100
        ]
    ]);
    ...
    
    ActiveForm::end();