PHPackages                             s4studio/yii2-switchery-widget - 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. s4studio/yii2-switchery-widget

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

s4studio/yii2-switchery-widget
==============================

iOS 7 style switch widget for Yii2.

1.1.9(6mo ago)09BSD-3-ClausePHP

Since Dec 22Pushed 6mo agoCompare

[ Source](https://github.com/s4studio/yii2-switchery-widget)[ Packagist](https://packagist.org/packages/s4studio/yii2-switchery-widget)[ Docs](https://github.com/s4studio/yii2-switchery-widget)[ RSS](/packages/s4studio-yii2-switchery-widget/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (2)Versions (10)Used By (0)

yii2-switchery-widget
=====================

[](#yii2-switchery-widget)

[![Latest Version](https://camo.githubusercontent.com/3205aae6398695b9c324445244799920847da0f9cf0ec3cefbefc2373a4500c1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f733473747564696f2f796969322d7377697463686572792d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://github.com/s4studio/yii2-switchery-widget/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/d5b06fbab77479c1a336537b600317513aae841166408aa6d25e2429cb5f6d82/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f733473747564696f2f796969322d7377697463686572792d7769646765742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/s4studio/yii2-switchery-widget)[![Coverage Status](https://camo.githubusercontent.com/4f5e76fe82511cb6dfe40817f685fbb8c0d3e7acdca6413eb3c2b3b05d2fe626/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f733473747564696f2f3a7061636b6167655f6e616d652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/s4studio/yii2-switchery-widget/code-structure)[![Quality Score](https://camo.githubusercontent.com/897f6075dbf25959d71bba836eab5a7172c2ca1af61ae0fe34e738fb09b965bc/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f733473747564696f2f796969322d7377697463686572792d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/s4studio/yii2-switchery-widget)[![Total Downloads](https://camo.githubusercontent.com/58e4c7860283776f2652e68132c8fd020bfbdadd1ab84300581cf3b4fe2c9681/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f733473747564696f2f796969322d7377697463686572792d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/s4studio/yii2-switchery-widget)

Yii2 wrapper for [iOS 7 style switches](http://abpetkov.github.io/switchery/) for your checkboxes

Install
-------

[](#install)

Via Composer

```
$ composer require s4studio/yii2-switchery-widget
```

or add inside compsoer.json

```
"s4studio/yii2-switchery-widget": "*"
```

to the `require` section of your `composer.json` file and add:

```
"repositories": [
    {
      "type": "package",
      "package": {
        "name": "bower-asset/switchery",
        "version": "0.8.2",
        "type": "bower-asset",
        "dist": {
          "type": "zip",
          "url": "https://github.com/abpetkov/switchery/archive/refs/tags/0.8.2.zip"
        }
      }
    }
  ]
```

Usage
-----

[](#usage)

```
use s4studio\switchery\Switchery;
use yii\web\JsExpression;

// usage with model
echo $form->field($model, 'is_required')->widget(Switchery::className(), [
      'options' => [
          'label' => false
      ],
      'clientOptions' => [
          'color' => '#5fbeaa',
      ]
 ]);

// usage without model
echo Switchery::widget([
    'name' => 'is_required',
    'value' => $model->is_required,
    'clientOptions' => [
        'color' => '#5FBEAA',
        'secondaryColor' => '#CCCCCC',
        'jackColor' => '#FFFFFF',
    ],
    'clientEvents' => [
        'change' => new JsExpression('function() {
            console.log("Cool! You changed my state.");
        }')
    ]
]);
```

Testing
-------

[](#testing)

```
$ phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Nikola Radovic](https://github.com/dzona)
- [All Contributors](../../contributors)

License
-------

[](#license)

The BSD License (BSD). Please see [License File](LICENSE.md) for more information.

> [![](https://camo.githubusercontent.com/9fd8f1de41dc23003bb2a54034cb6658dde5be97092e195a62d629d0d7fa7f6c/687474703a2f2f7777772e67726176617461722e636f6d2f6176617461722f35353336333339346437323934356666376564333132353536656330343165302e706e67)](http://www.2amigos.us)
>  *web development has never been so fun*
>  [www.2amigos.us](http://www.2amigos.us) [s4studio.pl](https://s4studio.pl)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance67

Regular maintenance activity

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~0 days

Total

9

Last Release

194d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9531269?v=4)[Edmund Kawalec](/maintainers/ekawalec)[@ekawalec](https://github.com/ekawalec)

---

Top Contributors

[![ekawalec](https://avatars.githubusercontent.com/u/9531269?v=4)](https://github.com/ekawalec "ekawalec (18 commits)")[![dzona](https://avatars.githubusercontent.com/u/1159689?v=4)](https://github.com/dzona "dzona (9 commits)")

---

Tags

yii2extensionyiiyii 2switcherys4studio

### Embed Badge

![Health badge](/badges/s4studio-yii2-switchery-widget/health.svg)

```
[![Health](https://phpackages.com/badges/s4studio-yii2-switchery-widget/health.svg)](https://phpackages.com/packages/s4studio-yii2-switchery-widget)
```

PHPackages © 2026

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