PHPackages                             roquie/laravel-dusk-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. [Testing &amp; Quality](/categories/testing)
4. /
5. roquie/laravel-dusk-select2

ActiveLibrary[Testing &amp; Quality](/categories/testing)

roquie/laravel-dusk-select2
===========================

Select2.js support for the Laravel Dusk testing.

2.1.0(5y ago)41349.6k—4.3%11[2 issues](https://github.com/roquie/laravel-dusk-select2/issues)2MITHTML

Since Mar 7Pushed 5y ago2 watchersCompare

[ Source](https://github.com/roquie/laravel-dusk-select2)[ Packagist](https://packagist.org/packages/roquie/laravel-dusk-select2)[ RSS](/packages/roquie-laravel-dusk-select2/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (13)Used By (2)

 [![](./logo.png)](./logo.png)

 [ ![](https://camo.githubusercontent.com/a880b5251127c4cbf8a7b7da5014c9cae0d730990c1444c79dad5073284837ed/68747470733a2f2f636972636c6563692e636f6d2f67682f726f717569652f6c61726176656c2d6475736b2d73656c656374322f747265652f6d61737465722e7376673f7374796c653d737667) ](https://circleci.com/gh/roquie/laravel-dusk-select2/tree/master) [ ![](https://camo.githubusercontent.com/2980a94e6c78d705f7918e7fdb133fc9bc905193ba603649fb51bc064b7d7e5c/68747470733a2f2f706f7365722e707567782e6f72672f726f717569652f6c61726176656c2d6475736b2d73656c656374322f762f737461626c65) ](https://packagist.org/packages/roquie/laravel-dusk-select2) [ ![](https://camo.githubusercontent.com/97f4822f040b269eb11b8d9535ad8bfc220c7e3fdadfb5deee750a30832bcf68/68747470733a2f2f706f7365722e707567782e6f72672f726f717569652f6c61726176656c2d6475736b2d73656c656374322f646f776e6c6f616473) ](https://packagist.org/packages/roquie/laravel-dusk-select2) [ ![](https://camo.githubusercontent.com/e3b6164a5c0a8c88857ea2b07a893751cc1f663c129e6539f323ff02b53983b7/68747470733a2f2f706f7365722e707567782e6f72672f726f717569652f6c61726176656c2d6475736b2d73656c656374322f6c6963656e7365) ](https://packagist.org/packages/roquie/laravel-dusk-select2)

Introduction
============

[](#introduction)

Select2.js support for the Laravel Dusk testing. Support Select2 v3 and Select2 v4 versions.

Demo
----

[](#demo)

 [![](./dusk-1.gif)](./dusk-1.gif)

Install
-------

[](#install)

`composer require --dev roquie/laravel-dusk-select2`

Now, u may use it!

Usage
-----

[](#usage)

For default select2:

```
$browse->select2('@selector');
```

`@selector` class name of your `` html tag.

If value not passed, it be selected automatically.

Another way, if need concrete value:

```
$browse->select2('@selector', 'you_text_value');
```

For multiple mode usage like this:

```
$browse->select2('@selector', ['foo', 'bar'], 5);
// the last parameter - maximum count of seconds for ajax loading before choice item.
```

Examples
--------

[](#examples)

[Here.](./tests/Browser/Select2Test.php)

Todo
----

[](#todo)

- Add Laravel Dusk tests for Laravel Dusk extend feature ;)
- Add gif demonstration how it works.
- May be use `+ select2` out of the box?.
- Integration with Circle CI.

Changelog
---------

[](#changelog)

### Upgrade from 2.0 to 2.1

[](#upgrade-from-20-to-21)

Without breaking changes.

#### Migration

[](#migration)

1. Update your `roquie/laravel-dusk-select2` dependency to `^2.1` in your `composer.json` file.

#### Changes

[](#changes)

1. This project moved back to native dependency `laravel/dusk` package and does not depend on full Laravel Framework like before in 1.\*.
2. Tests updated
3. Migrated to new phpunit schema.
4. Updated dependencies to latest versions.
5. Removed `composer.lock`
6. Fixed CI build
7. Tests moved to namespace.
8. Replaced Docker Image who runs these code.

### Upgrade from 1.\* to 2.0

[](#upgrade-from-1-to-20)

`2.0` version of this package potentially has full compatibility with select2 v.3 and v.4. But, I deleted a lot of code regarding select2 v.3. Tests passed for both versions, but with some changes.

#### Migration

[](#migration-1)

1. Update your `roquie/laravel-dusk-select2` dependency to `^2.0` in your `composer.json` file.
2. That's all ...

#### Changes

[](#changes-1)

1. Project migrated to `konsulting/dusk-standalone` package to run tests. It more better solution, compares to download full laravel framework.
2. Tests updated
3. Minimal PHP version is `7.1` (!)
4. Updated dependencies to latest versions.
5. Fixed a bug when search input founded but is not displayed.

### Upgrade from 0.1.\* to 1.0.\*

[](#upgrade-from-01-to-10)

1. Update your `roquie/laravel-dusk-select2` dependency to `^1.0` in your `composer.json` file.
2. Remove ` + .select2` from first parameter, also see [last parameter](./src/macro.php#L17).

Tests
-----

[](#tests)

Believe me, it's better to run it all in Docker:

- `make composer test`

License
-------

[](#license)

MIT License

Copyright (c) 2017-2021

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 77.5% 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 ~127 days

Recently: every ~274 days

Total

11

Last Release

2083d ago

Major Versions

0.1.4 → 1.0.02017-09-03

1.1.0 → 2.0.02019-07-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/35d8eff4a3e66b58f3e2af56fe948035469de1e19ac29c532d65c681955bbd18?d=identicon)[Roquie](/maintainers/Roquie)

---

Top Contributors

[![roquie](https://avatars.githubusercontent.com/u/3214290?v=4)](https://github.com/roquie "roquie (31 commits)")[![andrewmy](https://avatars.githubusercontent.com/u/715595?v=4)](https://github.com/andrewmy "andrewmy (7 commits)")[![Gremy87](https://avatars.githubusercontent.com/u/7533377?v=4)](https://github.com/Gremy87 "Gremy87 (1 commits)")[![johanvanhelden](https://avatars.githubusercontent.com/u/19389981?v=4)](https://github.com/johanvanhelden "johanvanhelden (1 commits)")

---

Tags

ajaxdusklaravelselect2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/roquie-laravel-dusk-select2/health.svg)

```
[![Health](https://phpackages.com/badges/roquie-laravel-dusk-select2/health.svg)](https://phpackages.com/packages/roquie-laravel-dusk-select2)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

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