PHPackages                             solarismedia/select2input - 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. [Templating &amp; Views](/categories/templating)
4. /
5. solarismedia/select2input

ActiveLibrary[Templating &amp; Views](/categories/templating)

solarismedia/select2input
=========================

Select2 form input for Nette

0.9.3(8y ago)018BSD-3-ClausePHPPHP ^7.1

Since Mar 4Pushed 3y agoCompare

[ Source](https://github.com/mareksolarismedia/Select2Input)[ Packagist](https://packagist.org/packages/solarismedia/select2input)[ RSS](/packages/solarismedia-select2input/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (4)Used By (0)

Select2Input
============

[](#select2input)

Install
-------

[](#install)

Download package

```
composer require tomaskarlik/select2input
```

Register extension in `config.neon`

```
select2: TomasKarlik\Select2Input\DI\Select2InputExtension
```

Download [Select2](https://select2.org/) or add to `bower.json` and include JS to your project

```
"dependencies": {
	"select2": "~4.0"
}
```

```
$(document).ready(function() {
	$('.select2').each(function() {
		$(this).select2({
			ajax: {
				url: $(this).data('select2-url'),
				dataType: 'json',
				// custom parameters
			}
		  });
	});
});
```

Form usage

```
$form = new Form;
$form->addSelect2('client_id', $clientRepository, 'Klient:')
	->setRequired('Vyberte klienta!')
	->setResultsPerPage(15);
$form->addSelect2Multiple('clients', $clientRepository, 'Klienti:')
```

Datasource example

```
namespace App\Model\Repository;

use TomasKarlik\Select2Input\ISelect2DataSource;
use TomasKarlik\Select2Input\Select2ResultEntity;

class ClientRepository implements ISelect2DataSource
{

	/**
	 * @param string $query
	 * @param int $limit
	 * @param int $offset
	 * @return Select2ResultEntity[]
	 */
	public function searchTerm(string $query, int $limit, int $offset): array
	{
		$return = [];
		$selection = $this->getClientTable()
			->where(
				'company ILIKE ?', '%' . $query . '%'
			)
			->order('company')
			->select('client.id, client.company')
			->limit($limit, $offset);

		while ($row = $selection->fetch()) {
			$result = new Select2ResultEntity;
			$result->setId($row->id);
			$result->setText($row->company);
			$return[] = $result;
		}
		return $return;
	}

	/**
	 * @param string $query
	 * @return int
	 */
	public function searchTermCount(string $query): int
	{
		return $this->getClientTable()
			->where(
				'company ILIKE ?', '%' . $query . '%'
			)
			->count('*');
	}

	/**
	 * @param mixed $key
	 * @return Select2ResultEntity|NULL
	 */
	public function findByKey($key): ?Select2ResultEntity
	{
		if ( ! is_numeric($key)) {
			return NULL;
		}

		$client = $this->getClientTable()->wherePrimary($key)->fetch();
		if ( ! $client) {
			return NULL;
		}

		$result = new Select2ResultEntity;
		$result->setId($client->id);
		$result->setText($client->company);
		return $result;
	}

}
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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.

###  Release Activity

Cadence

Every ~17 days

Total

3

Last Release

3009d ago

### Community

Maintainers

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

---

Top Contributors

[![tomaskarlik](https://avatars.githubusercontent.com/u/15874672?v=4)](https://github.com/tomaskarlik "tomaskarlik (5 commits)")[![Sofiosko](https://avatars.githubusercontent.com/u/24888906?v=4)](https://github.com/Sofiosko "Sofiosko (1 commits)")

---

Tags

netteinputFormsselect2

### Embed Badge

![Health badge](/badges/solarismedia-select2input/health.svg)

```
[![Health](https://phpackages.com/badges/solarismedia-select2input/health.svg)](https://phpackages.com/packages/solarismedia-select2input)
```

###  Alternatives

[ublaboo/datagrid

DataGrid for Nette Framework: filtering, sorting, pagination, tree view, table view, translator, etc

3042.0M26](/packages/ublaboo-datagrid)[contributte/forms-bootstrap

Nette extension for Bootstrap forms

221.1M4](/packages/contributte-forms-bootstrap)[nette/web-project

Nette: Standard Web Project

10993.3k](/packages/nette-web-project)[nepada/form-renderer

Latte template based form renderer for Nette forms with full support for Bootstrap 3, 4 &amp; 5.

11253.5k](/packages/nepada-form-renderer)

PHPackages © 2026

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