PHPackages                             tecnocen/yii2-bootstrap-year-calendar - 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. tecnocen/yii2-bootstrap-year-calendar

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

tecnocen/yii2-bootstrap-year-calendar
=====================================

Yii2 widget for bootstrap-year-calendar plugin

1.0.0(9y ago)1317.7k3[6 issues](https://github.com/tecnocen-com/yii2-bootstrap-year-calendar/issues)BSD-3-ClausePHP

Since May 20Pushed 9y ago6 watchersCompare

[ Source](https://github.com/tecnocen-com/yii2-bootstrap-year-calendar)[ Packagist](https://packagist.org/packages/tecnocen/yii2-bootstrap-year-calendar)[ Docs](https://github.com/tecnocen-com/yii2-bootstrap-year-calendar)[ RSS](/packages/tecnocen-yii2-bootstrap-year-calendar/feed)WikiDiscussions master Synced 1mo ago

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

Tecnocen.com Yii2 Bootstrap Year Calendar
=========================================

[](#tecnocencom-yii2-bootstrap-year-calendar)

[![Latest Stable Version](https://camo.githubusercontent.com/be55281c1de0c1a448821d73415ad20b8f287d13a6de583a55b7b1ce70d5eb66/68747470733a2f2f706f7365722e707567782e6f72672f7465636e6f63656e2f796969322d626f6f7473747261702d796561722d63616c656e6461722f762f737461626c65)](https://packagist.org/packages/tecnocen/yii2-bootstrap-year-calendar) [![Total Downloads](https://camo.githubusercontent.com/cd9ce8f96600687815407b6206679678b4808adfc2cdf88380436b242604b219/68747470733a2f2f706f7365722e707567782e6f72672f7465636e6f63656e2f796969322d626f6f7473747261702d796561722d63616c656e6461722f646f776e6c6f616473)](https://packagist.org/packages/tecnocen/yii2-bootstrap-year-calendar) [![Latest Unstable Version](https://camo.githubusercontent.com/220d9c4b207f4eb77f4de0543280c597b14c0165867f4152e829ae4044a79fb1/68747470733a2f2f706f7365722e707567782e6f72672f7465636e6f63656e2f796969322d626f6f7473747261702d796561722d63616c656e6461722f762f756e737461626c65)](https://packagist.org/packages/tecnocen/yii2-bootstrap-year-calendar) [![License](https://camo.githubusercontent.com/7cea4ce93bed0aaaf3da243c84aefe895cbff77dcf723b768851445de4211175/68747470733a2f2f706f7365722e707567782e6f72672f7465636e6f63656e2f796969322d626f6f7473747261702d796561722d63616c656e6461722f6c6963656e7365)](https://packagist.org/packages/tecnocen/yii2-bootstrap-year-calendar)

Widget that implements the [bootstrap-year-calendar](http://www.bootstrap-year-calendar.com/) plugin for Yii2

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

[](#installation)

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

Either run

```
composer require --prefer-dist "tecnocen/yii2-bootstrap-year-calendar:*"
```

or add

```
"tecnocen/yii2-bootstrap-year-calendar": "*"

```

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

Usage
-----

[](#usage)

### Calendar

[](#calendar)

This is the basic widget which encapsulates the plugin into a `yii\bootstrap\Widget` implementation.

```
use tecnocen\yearcalendar\widgets\Calendar;

echo Calendar::widget([
    // 'language' => 'es',
    'options' => [
        // HTML attributes for the container.
        // the `tag` option is specially handled as the HTML tag name
    ],
    'clientOptions' => [
        // JS Options to be passed to the `calendar()` plugin.
        // see http://bootstrap-year-calendar.com/#Documentation/Options
    ],
    'clientEvents' => [
        // JS Events for the `calendar()` plugin.
        // see http://bootstrap-year-calendar.com/#Documentation/Events
    ]
]);
```

### ActiveCalendar

[](#activecalendar)

The `ActiveCalendar` widget uses a \[dataProvider\] () to load the `dataSource` property passed to the calendar plugin.

The models returned by the dataProvider must implement the `tecnocen\yearcalendar\data\DataItem` interface.

### DataItem interface.

[](#dataitem-interface)

```
namespace api\models;

use tecnocen\yearcalendar\data\DataItem;
use tecnocen\yearcalendar\data\JsExpressionHelper;
use yii\db\ActiveRecord;

class Conference extends ActiveRecord implements DataItem
{
    public function getName()
    {
        return $this->name;
    }

    public function getStartDate()
    {
        return JsExpressionHelper::parse($this->start_date);
    }

    public function getEndDate()
    {
        return JsExpressionHelper::parse($this->end_date);
    }

    // rest of the active record code.
}
```

#### JsExpressionHelper

[](#jsexpressionhelper)

The `DataItem::getStartDate()` and `DataItem::getEndDate()` methods must return an instance of `yii\web\JsExpression` containing a javascript [Date](https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Date) object with only the year, month and day. Its adviced to create the JS object as follows

```
new Date(year, month, day);
```

The `JsExpressionHelper` simplifies this task by providing an static method `JsExpressionHelper::parse()` which can be used in the following manners.

```
// $dateTime is an object of the class DateTime
// see http://php.net/manual/en/class.datetime.php
JsExpressionHelper::parse($dateTime);

// $timestamp is an integer which will be used as
// unix time tamp
JsExpressionHelper::parse($timestamp);

// $date is an string here it can accept a second
// parameter $format which by default is 'Y-m-d'
// see http://php.net/manual/es/datetime.createfromformat.php
JsExpressionHelper::parse($date, $format);
```

All of them will return an object as expected for the calendar js plugin.

#### The Widget

[](#the-widget)

Once we have the model we can create the dataProvider and pass is to the `ActiveCalendar` widget.

```
use api\models\Conference;
use tecnocen\yearcalendar\widgets\ActiveCalendar;
use yii\data\ActiveDataProvider;

echo ActiveCalendar::widget([
    // 'language' => 'es',
    'dataProvider' => new ActiveDataProvider([
        'query' => Conference::find()->andWhere(['active' => 1])
    ]),
    'options' => [
        // HTML attributes for the container.
        // the `tag` option is specially handled as the HTML tag name
    ],
    'clientOptions' => [
        // JS Options to be passed to the `calendar()` plugin.
        // The `dataSource` property will be overwritten by the dataProvider.
        // see http://bootstrap-year-calendar.com/#Documentation/Options
    ],
    'clientEvents' => [
        // JS Events for the `calendar()` plugin.
        // see http://bootstrap-year-calendar.com/#Documentation/Events
    ]
])
```

### Language

[](#language)

The bootstrap-year-calendar plugin provides the \[following languages\] (), `Calendar` and `ActiveCalendar` support automatic translations using the `$language` class property which automatically will load the required js file and customize the plugin call.

```
echo Calendar::widget([
    'options' => ['id' => 'es-calendar'],
    'language' => 'es',
]);
```

Will add the JS File `bootstrap-year-calendar.es.js` to the view and run

```
jQuery('#es-calendar').calendar({"language":"es"});
```

On the browser.

Class Documentation
-------------------

[](#class-documentation)

TODO

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance11

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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

Unknown

Total

1

Last Release

3624d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d5f64412ef020f8c137ff5c7f5e4a0866271f2f9ba9584e5a24aa48467f958d?d=identicon)[Faryshta](/maintainers/Faryshta)

![](https://www.gravatar.com/avatar/2341d88f3cdea0c2474cfbf59e5cf6dab5dd6a026d7846fabf219f2a93be1641?d=identicon)[neverabe](/maintainers/neverabe)

---

Top Contributors

[![Faryshta](https://avatars.githubusercontent.com/u/2029247?v=4)](https://github.com/Faryshta "Faryshta (18 commits)")[![neverabe](https://avatars.githubusercontent.com/u/1173807?v=4)](https://github.com/neverabe "neverabe (2 commits)")[![RangelReale](https://avatars.githubusercontent.com/u/369785?v=4)](https://github.com/RangelReale "RangelReale (1 commits)")

---

Tags

yii2calendarwidgetyiibootstrapbootstrap-year-calendar

### Embed Badge

![Health badge](/badges/tecnocen-yii2-bootstrap-year-calendar/health.svg)

```
[![Health](https://phpackages.com/badges/tecnocen-yii2-bootstrap-year-calendar/health.svg)](https://phpackages.com/packages/tecnocen-yii2-bootstrap-year-calendar)
```

###  Alternatives

[romdim/yii2-bootstrap-material

Composer package for implementing FezVrasta's bootstrap material design in Yii2.

2010.9k3](/packages/romdim-yii2-bootstrap-material)

PHPackages © 2026

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