PHPackages                             shiyang/yii2-infinite-scroll - 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. shiyang/yii2-infinite-scroll

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

shiyang/yii2-infinite-scroll
============================

Yii2 extension for infinite-scroll jQuery plugin

v1.2(11y ago)03.1k11MITPHP

Since Apr 20Pushed 10y ago1 watchersCompare

[ Source](https://github.com/shi-yang/yii2-infinite-scroll)[ Packagist](https://packagist.org/packages/shiyang/yii2-infinite-scroll)[ RSS](/packages/shiyang-yii2-infinite-scroll/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (1)

yii2-infinite-scroll
====================

[](#yii2-infinite-scroll)

Yii2 extension for infinite-scroll jQuery plugin, providing scrolling functionality for widgets such as `ListView`. It renders a hyperlink that leads to subsequent page of a target and registers infinite-scroll jQuery plugin which uses javascript to fetch and append content for subsequent pages, gracefully degrading to complete page reload when javascript is disabled.

Several behaviours allowing to customize scroll behavior are provided out of the box, including twitter-style manual trigger, local scroll in overflow div, masonry integration and others.

Resources
---------

[](#resources)

- Yii2 [extension page](http://www.yiiframework.com/extension/yii2-infinite-scroll)
- Infinite-Scroll jQuery plugin [documentation](https://github.com/paulirish/infinite-scroll)

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

[](#installation)

### Composer

[](#composer)

Add extension to your `composer.json` and update your dependencies as usual, e.g. by running `composer update`

```
{
    "require": {
        "shiyang/yii2-infinite-scroll": "*"
    }
}
```

\##Widget Configuration

In addition to most of the properties that `LinkPager` provides, this widget also allows you to configure:

- $widgetId *string* owner widget id, required
- $itemsCssClass *string* CSS class of a tag that encapsulates items, required
- $pluginOptions *array* infinite-scroll jQuery plugin options. For more information refer to infinite-scroll [documentation](https://github.com/paulirish/infinite-scroll)
- $contentLoadedCallback *string|JsExpression* javascript callback to be executed on loading the content via ajax call

\##Sample Usage

Plugin works by appending fetched items to the end of parent container, so it is required to configure `layout` property of parent `ListView` widget, wrapping `{items}` into e.g. `div` container with some class (to be used as a selector). It is possible to configure all selectors that widget initializes plugin with to fit your project requirements, but it general it is enough to set `itemCssClass` (class of that wrapping tag that we created) and `widgetId` (which would ensure multiple plugins on the same page would not conflict).

So the minimal required configuration would look like this:

```
use shiyang\infinitescroll\InfiniteScrollPager;

echo ListView::widget([
    ...
    'id' => 'my-listview-id',
    'layout' => "{summary}\n{items}\n{pager}",
    'pager' => [
        'class' => InfiniteScrollPager::className(),
        'widgetId' => 'my-listview-id',
        'itemsCssClass' => 'items',
    ],
]);
```

An example illustrating how to customize some widget / plugin options:

```
use shiyang\infinitescroll\InfiniteScrollPager;

echo ListView::widget([
    ...
    'id' => 'my-listview-id',
    'layout' => "{summary}\n{items}\n{pager}",
    'pager' => [
        'class' => InfiniteScrollPager::className(),
        'widgetId' => 'my-listview-id',
        'itemsCssClass' => 'items',
        'contentLoadedCallback' => 'afterAjaxListViewUpdate',
        'nextPageLabel' => 'Load more items',
        'linkOptions' => [
            'class' => 'btn btn-lg btn-block',
        ],
        'pluginOptions' => [
            'loading' => [
                'msgText' => "Loading next set of items...",
                'finishedMsg' => "No more items to load",
            ],
            'behavior' => InfiniteScrollPager::BEHAVIOR_TWITTER,
        ],
    ],
]);
```

Or

Controller action:

```
function actionIndex()
{
    $query = Article::find()->where(['status' => 1]);
    $countQuery = clone $query;
    $pages = new Pagination(['totalCount' => $countQuery->count()]);
    $models = $query->offset($pages->offset)
        ->limit($pages->limit)
        ->all();

    return $this->render('index', [
        'models' => $models,
        'pages' => $pages,
    ]);
}

```

View:

```
use shiyang\infinitescroll\InfiniteScrollPager;

// display pagination
echo InfiniteScrollPager::widget([
   	'pagination' => $pages,
   	'widgetId' => '#content',
]);

```

\##License

Extension is released under MIT license, same as underlying jQuery plugin.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 58.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 ~0 days

Total

3

Last Release

4047d ago

### Community

Maintainers

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

---

Top Contributors

[![shi-yang](https://avatars.githubusercontent.com/u/5102567?v=4)](https://github.com/shi-yang "shi-yang (7 commits)")[![nirvana-msu](https://avatars.githubusercontent.com/u/5787387?v=4)](https://github.com/nirvana-msu "nirvana-msu (5 commits)")

---

Tags

pluginjqueryyii2widgetinfinite-scroll

### Embed Badge

![Health badge](/badges/shiyang-yii2-infinite-scroll/health.svg)

```
[![Health](https://phpackages.com/badges/shiyang-yii2-infinite-scroll/health.svg)](https://phpackages.com/packages/shiyang-yii2-infinite-scroll)
```

###  Alternatives

[kartik-v/yii2-widget-timepicker

Enhanced Yii2 wrapper for the bootstrap timepicker plugin (sub repo split from yii2-widgets)

404.9M14](/packages/kartik-v-yii2-widget-timepicker)[kartik-v/yii2-widget-sidenav

An enhanced side navigation menu styled for bootstrap (sub repo split from yii2-widgets)

364.0M8](/packages/kartik-v-yii2-widget-sidenav)[kartik-v/yii2-widget-colorinput

An enhanced Yii 2 widget encapsulating the HTML 5 color input (sub repo split from yii2-widgets)

324.8M10](/packages/kartik-v-yii2-widget-colorinput)[nullref/yii2-datatables

Yii2 Extension for DataTables jQuery plug-in

7290.3k](/packages/nullref-yii2-datatables)[kartik-v/yii2-widget-spinner

A widget to render animated CSS3 loading spinners with VML fallback for IE (sub repo split from yii2-widgets)

283.9M3](/packages/kartik-v-yii2-widget-spinner)[kartik-v/yii2-widget-affix

A scrollspy and affixed enhanced navigation to highlight page sections (sub repo split from yii2-widgets)

153.8M3](/packages/kartik-v-yii2-widget-affix)

PHPackages © 2026

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