PHPackages                             coderius/yii2-swiper-slider - 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. coderius/yii2-swiper-slider

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

coderius/yii2-swiper-slider
===========================

yii2 swiper slider

1.0.0.1(5y ago)02.4k↓50%MITPHPPHP &gt;=5.6.0

Since Oct 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/coderius/yii2-swiper-slider)[ Packagist](https://packagist.org/packages/coderius/yii2-swiper-slider)[ RSS](/packages/coderius-yii2-swiper-slider/feed)WikiDiscussions master Synced 1mo ago

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

Yii2 swiper slider widget
=========================

[](#yii2-swiper-slider-widget)

[![Software License](https://camo.githubusercontent.com/1d877c762c807aad2d667ce2d864a7c5d8f174a566fb5a88ce37df836ad6a919/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f6465726975732f796969322d7377697065722d736c69646572)](LICENSE.md)[![Code Coverage](https://camo.githubusercontent.com/ded9655e646a7c126b8f2f63f267d21a5680d96ff336186f37d595d575b79a40/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f6465726975732f796969322d7377697065722d736c696465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/coderius/yii2-swiper-slider/?branch=master)[![Scrutinizer code quality (GitHub/Bitbucket)](https://camo.githubusercontent.com/99dc118389d952891ec382ea2e8f2cc992fd2f63b9a12e494f25e0e87ca4d929/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f636f6465726975732f796969322d7377697065722d736c69646572)](https://camo.githubusercontent.com/99dc118389d952891ec382ea2e8f2cc992fd2f63b9a12e494f25e0e87ca4d929/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f636f6465726975732f796969322d7377697065722d736c69646572)[![CodeFactor](https://camo.githubusercontent.com/c650e50c0d5848aad3f812460a812a7bf223f9362bc81b6e5300fa2c4587bbb8/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f636f6465726975732f796969322d7377697065722d736c696465722f6261646765)](https://www.codefactor.io/repository/github/coderius/yii2-swiper-slider)[![StyleCI](https://camo.githubusercontent.com/e97c8e5cb012f62da574407b079f73f0c73f01dccd6848ceb16289c1d95e3e0c/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3330363935383632382f736869656c643f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/e97c8e5cb012f62da574407b079f73f0c73f01dccd6848ceb16289c1d95e3e0c/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3330363935383632382f736869656c643f6272616e63683d6d6173746572)

About
-----

[](#about)

This is yii2 extention widget renders js slider [Swiper](https://github.com/nolimits4web/swiper). This widget allows render slider in web page simply. Created for Yii2 framework.

[![Yii2 swiper slider widget example](https://raw.githubusercontent.com/coderius/github-images/master/ezgif.com-gif-maker.gif "Yii2 swiper slider widget example")](https://raw.githubusercontent.com/coderius/github-images/master/ezgif.com-gif-maker.gif)

[![Yii2 swiper slider widget example](https://raw.githubusercontent.com/coderius/github-images/master/FireShotCapture015-SwiperDemos-swiperjs.com.png "Yii2 swiper slider widget example")](https://raw.githubusercontent.com/coderius/github-images/master/FireShotCapture015-SwiperDemos-swiperjs.com.png)

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

[](#installation)

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

First download extention. Run the command in the terminal:

```
composer require coderius/yii2-swiper-slider:^1.0

```

or add in composer.json

```
"coderius/yii2-swiper-slider": "^1.0"

```

and run `composer update`

Usage
-----

[](#usage)

### Widger with minimum options

[](#widger-with-minimum-options)

You can only specify content for slides. This parameter is required.

In all files with widget put namespace to use class like:

```

```

### Widget options

[](#widget-options)

**Events**:

- EVENT\_BEFORE\_REGISTER\_DEFAULT\_ASSET
- EVENT\_AFTER\_REGISTER\_DEFAULT\_ASSET

Usage in widget:

```
echo \coderius\swiperslider\SwiperSlider::widget([
    ...
'on ' . \coderius\swiperslider\SwiperSlider::EVENT_AFTER_REGISTER_DEFAULT_ASSET => function(){
        CustomAsset::register($view);
},

```

**showScrollbar**: true | false. Default is false

**showPagination**: true | false. Default is true

**slides**: string | array | . Contents slides content like ![]() or any string. Or array with keys: *value*, *options*. *value* maybe like string or Closure (function($tag, $index, $self){}). Example:

```
'slides' => [
        [
            'value' => 'ggg',
            'options' => [
                'style' => ["background-image" => "url(https://swiperjs.com/demos/images/nature-1.jpg)"]
            ]
        ],
        [
            'value' => function($tag, $index, $self){
                return "some value {$index}";
            },
            'options' => [
                'style' => ["color" => "green"]
            ]
        ],
...

```

**clientOptions**: array. This options is pasted when initialize Swiper js (new Swiper('options here')). Please, remember that if you are required to add javascript to the configuration of the js plugin and is required to be plain JS, make use of `JsExpression`. That class was made by Yii for that specific purpose. For example:

```
'clientOptions' => [
    'slidesPerView' => 4,
    'spaceBetween'=> 30,
    'centeredSlides'=> true,
    'pagination' => [
        'clickable' => true,
        'renderBullet' => new \yii\web\JsExpression("function (index, className) {
                return '' + (index + 1) + '';
            },
        "),
        ],
        "scrollbar" => [
            "el" => \coderius\swiperslider\SwiperSlider::getItemCssClass(SwiperSlider::SCROLLBAR),
            "hide" => true,
        ],
],

```

**options**: array. This options is pasted when rendered dom elements. Various attributes for html elements are set here. This params allowed only for all template items:

```
//Global styles to elements. If create styles for all slides
'options' => [
    'styles' => [
        \coderius\swiperslider\SwiperSlider::CONTAINER => ["height" => "100px"],
        \coderius\swiperslider\SwiperSlider::SLIDE => ["text-align" => "center"],
    ],
    'class' => [\coderius\swiperslider\SwiperSlider::CONTAINER => ["myClass"],]
],

```

It is best to use constants to specify template elements:

- CONTAINER = 'container';
- WRAPPER = 'wrapper';
- SLIDE = 'slide';
- PAGINATION = 'pagination';
- BUTTON\_PREV = 'button-prev';
- BUTTON\_NEXT = 'button-next';
- SCROLLBAR = 'scrollbar';

Testing
-------

[](#testing)

Run tests in extention folder.

```
$ ./vendor/bin/phpunit
```

Note! For running all tests needed upload all dependencies by composer. If tested single extention, then run command from root directory where located extention:

```
composer update

```

When all dependencies downloaded run all tests in terminal from root folder:

```
./vendor/bin/phpunit tests

```

Or for only unit:

```
./vendor/bin/phpunit --testsuite Unit

```

If extention tested in app, then set correct path to phpunit and run some commands.

Credits
-------

[](#credits)

- [Sergio Coderius](https://github.com/coderius)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

2021d ago

Major Versions

0.0.1 → 1.0.02020-11-04

### Community

Maintainers

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

---

Top Contributors

[![coderius](https://avatars.githubusercontent.com/u/36597893?v=4)](https://github.com/coderius "coderius (48 commits)")

---

Tags

sliderswiperyii2-extensionyii2-slider-widgetyii2-widgetsyii2yii2-extensionsliderswiperyii2 slideryii2 modules

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/coderius-yii2-swiper-slider/health.svg)

```
[![Health](https://phpackages.com/badges/coderius-yii2-swiper-slider/health.svg)](https://phpackages.com/packages/coderius-yii2-swiper-slider)
```

###  Alternatives

[romka-chev/yii2-swiper

Yii2 extension for Swiper slider

1840.6k](/packages/romka-chev-yii2-swiper)[yii2mod/yii2-ion-slider

Ion.RangeSlider Widget for Yii 2

21138.3k](/packages/yii2mod-yii2-ion-slider)[simialbi/yii2-kanban

Kanban board module for yii2

111.1k1](/packages/simialbi-yii2-kanban)

PHPackages © 2026

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