PHPackages                             2amigos/yii2-switch-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. 2amigos/yii2-switch-widget

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

2amigos/yii2-switch-widget
==========================

The bootstrap switch widget for the Yii framework

1.0.2(8y ago)17119.6k↓18.8%13[1 issues](https://github.com/2amigos/yii2-switch-widget/issues)5BSD-3-ClausePHP

Since Apr 2Pushed 8y ago19 watchersCompare

[ Source](https://github.com/2amigos/yii2-switch-widget)[ Packagist](https://packagist.org/packages/2amigos/yii2-switch-widget)[ Docs](https://github.com/2amigos/yii2-switch-widget)[ RSS](/packages/2amigos-yii2-switch-widget/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (7)Used By (5)

Bootstrap Switch Widget for Yii2
================================

[](#bootstrap-switch-widget-for-yii2)

[![Latest Version](https://camo.githubusercontent.com/ebd369d1fad16dd098cfd7f39dc7c4ec382f16faf7f04ab98be4b2deb86462e5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f32616d69676f732f796969322d7377697463682d7769646765742e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/2amigos/yii2-switch-widget/tags)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/61bb284df08bbf88250fe4d3464bd2c9f812e8e617fcf384b328f363ac9bfd1c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f32616d69676f732f796969322d7377697463682d7769646765742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/2amigos/yii2-switch-widget)[![Coverage Status](https://camo.githubusercontent.com/67dbf9291aa873fc6e086209db54b95228d4c30974865d2da1cc37e9ddd0e629/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f32616d69676f732f796969322d7377697463682d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-switch-widget/code-structure)[![Quality Score](https://camo.githubusercontent.com/33233d13fb3b2b6bb44fc137de920130d52b229dc6b3293c9bfd44b03bd3fab7/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f32616d69676f732f796969322d7377697463682d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-switch-widget)[![Total Downloads](https://camo.githubusercontent.com/1db2d58e9e93f339dd8bbd6fa634171f87a3c3a5ab29b26d2c2288784e9e1233/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f32616d69676f732f796969322d7377697463682d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/2amigos/yii2-switch-widget)

Renders a [Bootstrap Toggle Switch plugin](http://bootstrapswitch.com/) widget.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require 2amigos/yii2-switch-widget:~1.0
```

or add

```
"2amigos/yii2-switch-widget": "~1.0"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

The widget comes in two flavors:

- SwitchBox
- SwitchRadio

**SwitchBox**

This widget renders a Bootstrap Toggle Switch Checkbox input control. Best suitable for attributes with boolean states (on|off, true|false, 1|0) when used with model.

***Example of use with a form***

```

```

***Example of use without a model***

```

```

**SwitchRadio**

This widget renders a Bootstrap Toggle Switch Checkbox radio list control. Best suitable for attributes with multiple states when used with a model.

***Example of use with a form***

```

```

***Example of use without a model***

```
