PHPackages                             sjaakp/yii2-datepager - 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. sjaakp/yii2-datepager

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

sjaakp/yii2-datepager
=====================

Page data on date value in Yii2.

1.1.1(1y ago)1167[1 issues](https://github.com/sjaakp/yii2-datepager/issues)MITPHP

Since Feb 9Pushed 1y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

yii2-datepager
==============

[](#yii2-datepager)

#### Paging on date values for Yii2

[](#paging-on-date-values-for-yii2)

[![Latest Stable Version](https://camo.githubusercontent.com/86da9a8947d99334894079055cb9857d7a4498ca40fb8140ad37c53a877c6cf1/68747470733a2f2f706f7365722e707567782e6f72672f736a61616b702f796969322d6461746570616765722f762f737461626c65)](https://packagist.org/packages/sjaakp/yii2-datepager)[![Total Downloads](https://camo.githubusercontent.com/9bc5b4148c740fe09ab64bddd808cb07501b16a74ef6dc9c4e1aeb286207c4b4/68747470733a2f2f706f7365722e707567782e6f72672f736a61616b702f796969322d6461746570616765722f646f776e6c6f616473)](https://packagist.org/packages/sjaakp/yii2-datepager)[![License](https://camo.githubusercontent.com/1fa1e3a3050fb06db9de477289f8d1502bbe7c4328c83f3d914ddecf778c9c5e/68747470733a2f2f706f7365722e707567782e6f72672f736a61616b702f796969322d6461746570616765722f6c6963656e7365)](https://packagist.org/packages/sjaakp/yii2-datepager)

These classes enable database paging based on date values in the [Yii 2.0](https://yiiframework.com/ "Yii") PHP Framework.

A demonstration of **yii2-datepager** is [here](https://sjaakpriester.nl/software/datepager).

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

[](#installation)

The preferred way to install **yii2-datepager** is through [Composer](https://getcomposer.org/). Either add the following to the require section of your `composer.json` file:

`"sjaakp/yii2-datepager": "*"`

Or run:

`composer require sjaakp/yii2-datepager "*"`

You can manually install **yii2-datepager** by [downloading the source in ZIP-format](https://github.com/sjaakp/yii2-datepager/archive/master.zip).

Using Datepager
---------------

[](#using-datepager)

Using **Yii2 Datepager** is easy. A minimum usage scenario would look like the following. In `EventController.php` we would have something like:

```

```

Classes
-------

[](#classes)

### ActiveDataProvider

[](#activedataprovider)

This is an extension from its Yii-counterpart in `yii\data`, and can be used in the same way. It is important to set attribute `$dateAttribute`.

#### $dateAttribute

[](#dateattribute)

`string` Set this to the name of the attribute which is used to define the pages. Must be set.

#### $interval

[](#interval)

`string` Defines the interval of the pages. Must be set in a form PHP's [`DateInterval`](https://www.php.net/manual/en/dateinterval.construct.php)can understand. Default: `'P1Y'` (one year).

#### $ascending

[](#ascending)

`bool` Whether the **DatePager** pages are rendered in ascending or descending order. Default: `true` (ascending).

#### $beginDate

[](#begindate)

`string` Date of the first **Datepager** page. If not set (default), **Datepager** determines this date itself. It can be set to any date within the range of the first page. Format: any PHP [date format](https://www.php.net/manual/en/datetime.formats.date.php).

#### $endDate

[](#enddate)

`string` Date of the last **Datepager** page. If not set (default), **Datepager** determines this date itself. It can be set to any date within the range of the last page. Format: any PHP [date format](https://www.php.net/manual/en/datetime.formats.date.php).

#### $dateParam

[](#dateparam)

`string` The **Datepager** HTML parameter name. Default value: `'date'`. Might be changed if there is a conflict with other functionality.

---

### DatePager

[](#datepager)

This is the widget that renders the actual datepager. The attribute `$dataProvider` must be set.

#### $dataProvider

[](#dataprovider)

The **Datepager** `ActiveDataProvider` that this pager is associated with. Must be set.

#### $maxButtonCount

[](#maxbuttoncount)

`int` The maximum number of page buttons rendered. Default: `10`.

#### $labelFormat

[](#labelformat)

`null|string|callable` Defines the format of the page label.

- If `null`: **DatePager** determines the format based on the dataprovider's interval.
- If `string`: a date format according to Yii's [`Fomrmatter::dateformat`](https://www.yiiframework.com/doc/api/2.0/yii-i18n-formatter#$dateFormat-detail).
- If `callable`: a `function($page, $datePager)`, returning a `string`, where `$page` is a PHP [`DateTimeInterface`](https://www.php.net/manual/en/class.datetimeinterface.php).

#### $options

[](#options)

`array` HTML options for the datepager container tag. Default: `[ 'class' => 'pagination' ]`, compatible with Bootstrap.

#### $buttonOptions

[](#buttonoptions)

`array` HTML options for the datepager buttons. Default: `[ 'class' => 'page-item' ]`, compatible with Bootstrap 4.

#### $linkOptions

[](#linkoptions)

`array` HTML options for the datepager links. Default: `[ 'class' => 'page-link' ]`, compatible with Bootstrap 4.

#### $activePageCssClass

[](#activepagecssclass)

`string` CSS class of the active page. Default: `'active'`.

#### $disabledPageCssClass

[](#disabledpagecssclass)

`string` CSS class of a disabled page. Default: `'disabled'`.

#### $prevPageLabel, $nextPageLabel

[](#prevpagelabel-nextpagelabel)

`'string'` Text labels for the previous and next buttons, will not be HTML encoded. If `false`, the button will not be rendered. Defaults: `'&laquo;'` and `'&raquo;'`.

#### $firstPageLabel, $lastPageLabel

[](#firstpagelabel-lastpagelabel)

`'string'` Text labels for the first and last buttons, will not be HTML encoded. If `false` (default), the button will not be rendered.

All properties, except `$dataProvider` and `$labelFormat` are direct equivalents of their counterparts in Yii's [LinkPager](https://www.yiiframework.com/doc/api/2.0/yii-widgets-linkpager).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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 ~801 days

Total

3

Last Release

682d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/156f636aceedc73021a2bfafb5433271c2c55d6cf4bce06b12902c85b4b491f1?d=identicon)[sjaakp](/maintainers/sjaakp)

---

Top Contributors

[![sjaakp](https://avatars.githubusercontent.com/u/5585878?v=4)](https://github.com/sjaakp "sjaakp (5 commits)")

---

Tags

paginationpagingyii2extensionwidgetyiigridviewListView

### Embed Badge

![Health badge](/badges/sjaakp-yii2-datepager/health.svg)

```
[![Health](https://phpackages.com/badges/sjaakp-yii2-datepager/health.svg)](https://phpackages.com/packages/sjaakp-yii2-datepager)
```

###  Alternatives

[sjaakp/yii2-alphapager

Page data on initial character in Yii2.

184.4k](/packages/sjaakp-yii2-alphapager)[sjaakp/yii2-taggable

Manage tags of ActiveRecord in Yii2.

3030.6k](/packages/sjaakp-yii2-taggable)

PHPackages © 2026

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