PHPackages                             naduvko/yii2-calendarview-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. [Templating &amp; Views](/categories/templating)
4. /
5. naduvko/yii2-calendarview-widget

ActiveYii2-extension[Templating &amp; Views](/categories/templating)

naduvko/yii2-calendarview-widget
================================

CalendarView widget for Yii 2 Framework Bootstrap4.

1.1.2(6y ago)033MITPHP

Since Aug 18Pushed 6y agoCompare

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

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

yii2-calendarview-widget
========================

[](#yii2-calendarview-widget)

Yii2 CalendarView Widget
========================

[](#yii2-calendarview-widget-1)

About
-----

[](#about)

Ever needed to display table records as a calendar display using just a data provider and a date field? Using Bootstrap 3 and jQuery to create a responsive calendar widget which displays any number of events.

Now with internalizations into 7 languages (slovak, czech, german, english, spanish, russian, and polish), for additional translations send pull requests please.

[![CalendarView Widget](https://camo.githubusercontent.com/7f38b74d2301a182ac364d432c2db57d7683330e978ccbfa12c0783a73ea5156/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f34343830363638302f796969322d63616c656e646172766965772d7769646765742e706e67 "CalendarView Widget")](https://camo.githubusercontent.com/7f38b74d2301a182ac364d432c2db57d7683330e978ccbfa12c0783a73ea5156/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f34343830363638302f796969322d63616c656e646172766965772d7769646765742e706e67)

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist naduvko/yii2-calendarview-widget "^1.0"

```

or add

```
"naduvko/yii2-calendarview-widget": "^1.0"

```

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

Usage
-----

[](#usage)

To use this widget, you will need a controller and a view:

Lets say you got a table with a standard model and search provider (instanceof [\\yii\\data\\DataProviderInterface](http://www.yiiframework.com/doc-2.0/yii-data-dataproviderinterface.html)) that you use in your [GridView](http://www.yiiframework.com/doc-2.0/yii-grid-gridview.html) for example :

```
CREATE TABLE `calendar` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Date',
  `val` int(11) NOT NULL COMMENT 'Value',
  PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8
```

#### models/Calendar.php

[](#modelscalendarphp)

just a standard activity record model for instance

```
class Calendar extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'calendar';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['date', 'val'], 'required'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'date' => 'Date',
            'val' => 'Value',
        ];
    }
}
```

#### models/search/CalendarSearch.php

[](#modelssearchcalendarsearchphp)

just a standard search provider

```
class CalendarSearch extends Calendar
{
    public function search($params)
    {
        $query = Activity::find()->where(['user_id'=>Yii::$app->user->getId()]);

        $dataProvider = new ActiveDataProvider([
             'query' => $query,
             'pagination' => ['pageSize' => 30],
             'sort'=> ['defaultOrder' => ['start'=>SORT_DESC]]
         ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'date' => $this->calories,
            'val' => $this->peak_heartrate,
        ]);

        return $dataProvider;
    }
}
```

then you will need a controller

#### controllers/CalendarController.php

[](#controllerscalendarcontrollerphp)

```
class CalendarController extends Controller
{
    public function actionIndex()
    {
        $searchModel = new CalendarSearch;
        $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());

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

and the view

#### views/calendar/index.php

[](#viewscalendarindexphp)

```
use naduvko\calendarview\CalendarView;

echo CalendarView::widget(
    [
        // mandatory
        'dataProvider'  => $dataProvider,
        'dateField'     => 'date',
        'valueField'    => 'val',

        // optional params with their defaults
        'unixTimestamp' => false, // indicate whether you use unix timestamp instead of a date/datetime format in the data provider
        'weekStart' => 1, // date('w') // which day to display first in the calendar
        'title'     => 'Calendar',

        'views'     => [
            'calendar' => '@vendor/naduvko/yii2-calendarview-widget/views/calendar',
            'month' => '@vendor/naduvko/yii2-calendarview-widget/views/month',
            'day' => '@vendor/naduvko/yii2-calendarview-widget/views/day',
        ],

        'startYear' => date('Y') - 1,
        'endYear' => date('Y') + 1,

        'link' => false,
        /* alternates to link , is called on every models valueField, used in Html::a( valueField , link )
        'link' => 'site/view',
        'link' => function($model,$calendar){
            return ['calendar/view','id'=>$model->id];
        },
        */

        'dayRender' => false,
        /* alternate to dayRender
        'dayRender' => function($model,$calendar) {
            return ''.$model->id.'';
        },
        */

    ]
);
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 59.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 ~368 days

Total

4

Last Release

2450d ago

### Community

Maintainers

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

---

Top Contributors

[![marekpetras](https://avatars.githubusercontent.com/u/8991813?v=4)](https://github.com/marekpetras "marekpetras (16 commits)")[![naduvko](https://avatars.githubusercontent.com/u/615788?v=4)](https://github.com/naduvko "naduvko (11 commits)")

---

Tags

viewyii2extensioncalendarwidgetactiverecorddataprovider

### Embed Badge

![Health badge](/badges/naduvko-yii2-calendarview-widget/health.svg)

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

###  Alternatives

[marekpetras/yii2-calendarview-widget

CalendarView widget for Yii 2 Framework.

2229.1k](/packages/marekpetras-yii2-calendarview-widget)

PHPackages © 2026

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