adlurfm/yii2-fullcalendar-2

FullCalendar.io component in Yii2

Installs: 31

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

dev-main 2023-01-20 08:00 UTC

This package is auto-updated.

Last update: 2024-05-20 10:48:51 UTC


README

FullCalendar.io component for Yii2

Installation

$ php composer.phar require adlurfm/yii2-fullcalendar-2

or add

"adlurfm/yii2-fullcalendar-2": "dev-main"

to the require section of your composer.json file.

Usage

//View File
<?= FullCalendar::widget([
        'id'       => 'calendar',
        'clientOptions' => [
            'initialDate' => date('Y-m-d'),
            'timeZone'=>'Asia/Kuala_lumpur',
            'weekNumbers' => true,
            'selectable'  => true,
            'initialView' => 'timeGridWeek',
            'events' =>Url::to(['site/events']),
            'eventTimeFormat'=> [ // like '14:30'
                'hour'=>'2-digit',
                'minute'=>'2-digit',
                'meridiem' => false,
                'hour12'=> false
            ]
        ],
    ]); ?>
    
//Controller File - Return as JSON format
public function actionEvents($start, $end)
{
        \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
        return [
                [
                        'title'=>'All Day Event',
                        'start'=>'2023-01-01'
                ],
                [
                        'title'=>'Long Event',
                        'start'=>'2023-01-04',
                        'end'=>'2023-01-11'
                ],
        ];
        //Read more about event at https://fullcalendar.io/docs/event-parsing
}

Read more options at - fullcalendar.io