PHPackages                             indicalabs/yii2-select2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. indicalabs/yii2-select2

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

indicalabs/yii2-select2
=======================

The Select2 widget for the Yii framework

0229PHPCI failing

Since Sep 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/indicalabs/yii2-select2)[ Packagist](https://packagist.org/packages/indicalabs/yii2-select2)[ RSS](/packages/indicalabs-yii2-select2/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Select2 for Yii2
================

[](#select2-for-yii2)

Wrapper Widget to use jQuery Plugin Select2 in Yii2 application.

Select2 script:

Installation
------------

[](#installation)

Download or clone this repository and paste in `/PROJECT-ROOT/vendor/yiisoft/yii2-select2/yii/select2`

Configure this extension in /PROJECT-ROOT/vendor/yiisoft/extensions.php

'yiisoft/yii2-typeahead' =&gt; array ( 'name' =&gt; 'yiisoft/yii2-typeahead', 'version' =&gt; '9999999-dev', 'alias' =&gt; array ( '@yii/typeahead' =&gt; $vendorDir . '/yiisoft/yii2-typeahead/yii/typeahead', ), ),

Usage
-----

[](#usage)

In your view file (\_form.php)

 $model, 'attribute' =&gt; 'country\_id', 'clientOptions' =&gt; \[ //'local' =&gt; \[\], 'name' =&gt; 'country\_id', 'limit' =&gt; 1, 'valueKey' =&gt; 'text', 'remote' =&gt; \[ 'url' =&gt; Yii::$app-&gt;urlManager-&gt;createAbsoluteUrl('data/country/findcountry'). '&amp;term=%QUERY', // 'cache' =&gt; false, \], 'engine' =&gt; new yii\\web\\JsExpression('Hogan'), 'template' =&gt; '{{id}}**{{text}}** - {{id}}

', \], 'events' =&gt; \[ 'selected' =&gt; new yii\\web\\JsExpression("function(evt,data) { alert(data); };"), \], \]); ?&gt; ```
Or in config
```php
    ...
    'import' => array(
        ...
        'ext.select2.Select2',
        ...
    ),
    ...

```

Example:
--------

[](#example)

You can replace the
`CHtml::dropDownList()` by `Select2::dropDownList()`
`CHtml::activeDropDownList()` by `Select2::activeDropDownList()`

Or

```
    ...
    echo Select2::multiSelect("test", null, array('test1','test2'), array(
        'required' => 'required',
        'placeholder' => 'This is a placeholder',
        'select2Options' => array(
            'maximumSelectionSize' => 2,
        ),
    ));
    ...
    echo Select2::activeMultiSelect($model, "attr", array('test1','test2'), array(
        'placeholder' => 'This is a placeholder',
    ));
    ...
```

Or this

```
    ...
    $this->widget('Select2', array(
       'name' => 'inputName',
       'value' => 2,
       'data' => array(
           1 => 'Option 1',
           2 => 'Option 2',
           3 => 'Option 3',
           4 => 'Option 4',
        ),
    ));
    ...
```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc7377123e845bdd9bcf971b40a54875a504eb4a2f24d980346336e07b0e4e14?d=identicon)[indicalabs](/maintainers/indicalabs)

---

Top Contributors

[![VenuNarukulla](https://avatars.githubusercontent.com/u/3653887?v=4)](https://github.com/VenuNarukulla "VenuNarukulla (24 commits)")

### Embed Badge

![Health badge](/badges/indicalabs-yii2-select2/health.svg)

```
[![Health](https://phpackages.com/badges/indicalabs-yii2-select2/health.svg)](https://phpackages.com/packages/indicalabs-yii2-select2)
```

###  Alternatives

[ircmaxell/php-math-parser

A simple shunting-yard based math parser and executor for PHP

2916.7k](/packages/ircmaxell-php-math-parser)[bmcclure/cakephp-media-plugin

CakePHP Media Plugin

591.4k](/packages/bmcclure-cakephp-media-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
