PHPackages                             smirltech/laravel-fullcalendar - 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. smirltech/laravel-fullcalendar

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

smirltech/laravel-fullcalendar
==============================

Laravel 9 helper for FullCalendar.io

v1.1.0(3y ago)02.7k↓50%MITPHPPHP ^8.0

Since Dec 28Pushed 3y agoCompare

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

READMEChangelog (5)Dependencies (1)Versions (7)Used By (0)

Laravel 9 Full Calendar Helper
==============================

[](#laravel-9-full-calendar-helper)

[![Latest Stable Version](https://camo.githubusercontent.com/fbcc9f7d35c3de227c1c7f2197d8bc34b8034bf90d74eae26d312ea7ec2fd3c0/68747470733a2f2f706f7365722e707567782e6f72672f736d69726c746563682f6c61726176656c2d66756c6c63616c656e6461722f762f737461626c65)](https://packagist.org/packages/smirltech/laravel-fullcalendar) [![Total Downloads](https://camo.githubusercontent.com/16d231440b0747465a088886cf158f270eb43da3cb6fdeb5fdb01b2f377fec75/68747470733a2f2f706f7365722e707567782e6f72672f736d69726c746563682f6c61726176656c2d66756c6c63616c656e6461722f646f776e6c6f616473)](https://packagist.org/packages/smirltech/laravel-fullcalendar) [![Latest Unstable Version](https://camo.githubusercontent.com/a7917a5184773c4479332cfac428695c7a474a215b666d1e81bb7f29b9871fad/68747470733a2f2f706f7365722e707567782e6f72672f736d69726c746563682f6c61726176656c2d66756c6c63616c656e6461722f762f756e737461626c65)](https://packagist.org/packages/smirltech/laravel-fullcalendar) [![License](https://camo.githubusercontent.com/a9ff2b3b42dc633a441e3b04105d3a6e9f1c86c892c254c79dba07e31ed5a6e5/68747470733a2f2f706f7365722e707567782e6f72672f736d69726c746563682f6c61726176656c2d66756c6c63616c656e6461722f6c6963656e7365)](https://packagist.org/packages/smirltech/laravel-fullcalendar)

This is a simple helper package to make generating  in Laravel apps easier.

Installing
----------

[](#installing)

Require the package with composer using the following command:

```
composer require smirltech/laravel-fullcalendar

```

Or add the following to your composer.json's require section and `composer update`

```
"require": {
	"smirltech/laravel-fullcalendar": "~1.0.2"
}
```

The provider and `Calendar` alias will be registered automatically.

You won't need to include [fullcalendar.io](http://fullcalendar.io/)'s files in your HTML, version 6.0.2 is included in this package.

Usage
-----

[](#usage)

### Creating Events

[](#creating-events)

#### Using `event()`:

[](#using-event)

The simpliest way to create an event is to pass the event information to `Calendar::event()`:

```
$event = \Calendar::event(
    "Valentine's Day", //event title
    true, //full day event?
    '2015-02-14', //start time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg)
    '2015-02-14', //end time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg),
	1, //optional event ID
	[
		'url' => 'http://full-calendar.io'
	]
);
```

#### Implementing `Event` Interface

[](#implementing-event-interface)

Alternatively, you can use an existing class and have it implement `SmirlTech\LaravelFullcalendar\Event`. An example of an Eloquent model that implements the `Event` interface:

```
class EventModel extends Eloquent implements \SmirlTech\LaravelFullcalendar\Event
{

    protected $dates = ['start', 'end'];

    /**
     * Get the event's id number
     *
     * @return int
     */
    public function getId() {
		return $this->id;
	}

    /**
     * Get the event's title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Is it an all day event?
     *
     * @return bool
     */
    public function isAllDay()
    {
        return (bool)$this->all_day;
    }

    /**
     * Get the start time
     *
     * @return DateTime
     */
    public function getStart()
    {
        return $this->start;
    }

    /**
     * Get the end time
     *
     * @return DateTime
     */
    public function getEnd()
    {
        return $this->end;
    }
}
```

#### `IdentifiableEvent` Interface

[](#identifiableevent-interface)

If you wish for your existing class to have event IDs, implement `\SmirlTech\LaravelFullcalendar\IdentifiableEvent` instead. This interface extends `\SmirlTech\LaravelFullcalendar\Event` to add a `getId()` method:

```
class EventModel extends Eloquent implements \SmirlTech\LaravelFullcalendar\IdentifiableEvent
{

	// Implement all Event methods ...

    /**
     * Get the event's ID
     *
     * @return int|string|null
     */
    public function getId();

}
```

### Additional Event Parameters

[](#additional-event-parameters)

If you want to add [additional parameters](http://fullcalendar.io/docs/event_data/Event_Object) to your events, there are two options:

#### Using `Calendar::event()`

[](#using-calendarevent)

Pass an array of `'parameter' => 'value'` pairs as the 6th parameter to `Calendar::event()`:

```
$event = \Calendar::event(
    "Valentine's Day", //event title
    true, //full day event?
    '2015-02-14', //start time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg)
    '2015-02-14', //end time, must be a DateTime object or valid DateTime format (http://bit.ly/1z7QWbg),
	1, //optional event ID
	[
		'url' => 'http://full-calendar.io',
		//any other full-calendar supported parameters
	]
);
```

#### Add an `getEventOptions` method to your event class

[](#add-an-geteventoptions-method-to-your-event-class)

```
