PHP code example of hscstudio / yii2-fullcalendar

1. Go to this page and download the library: Download hscstudio/yii2-fullcalendar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hscstudio / yii2-fullcalendar example snippets

	
 $eventUrl = \yii\helpers\Url::to(['event-calendar']); 

public function actionEventCalendar($start=NULL,$end=NULL,$_=NULL){

	\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

	$model= \app\models\Event::find()->all();
	if(!empty($start) and !empty($end)){
		$model= \app\models\Event::find()
			->where(['>=','start',date('Y-m-d 00:00:01',strtotime($start))])
            ->andWhere(['<=','end',date('Y-m-d 23:59:59',strtotime($end))])
			->all();
	}

	$events = [];
	foreach ($model as $event) {
		$events[]=[
			'title'=>$event->title,
			'start'=>date('Y-m-d 00:00:01',strtotime($event->start)),
			'end'=>date('Y-m-d 23:59:59', strtotime($event->end)),
			//'color'=>'#CC0000',
			//'allDay'=>true,
			//'url'=>'http://anyurl.com'
		];
	}
	return $events;
}

php composer.phar