Download the PHP package iwandessers/laravel-calendar without Composer
On this page you can find all versions of the php package iwandessers/laravel-calendar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download iwandessers/laravel-calendar
More information about iwandessers/laravel-calendar
Files in iwandessers/laravel-calendar
Package laravel-calendar
Short Description Laravel helper for FullCalendar.io
License MIT
Informations about the package laravel-calendar
Laravel 11 Full Calendar
This is a simple helper package to make generating http://fullcalendar.io in Laravel apps easier.
Thanks to @maddhatter for the initial repo for laravel < 7
Thanks to @acaronlex for the updated repo for laravel 7 and 8
Thanks to @Spotawheel for the updated repo for laravel 9 and 10
Installing
Require the package with composer using the following command:
composer require iwandessers/laravel-calendar
The provider and Calendar
alias will be registered automatically.
You will also need to include fullcalendar.io's files in your HTML.
You can add it using the jsdelivr
Usage
Creating Events
Using event()
:
The simpliest way to create an event is to pass the event information to Calendar::event()
:
Implementing Event
Interface
Alternatively, you can use an existing class and have it implement Iwan\LaravelCalendar\Event
. An example of an Eloquent model that implements the Event
interface:
IdentifiableEvent
Interface
If you wish for your existing class to have event IDs, implement \Iwan\LaravelCalendar\IdentifiableEvent
instead. This interface extends \Iwan\LaravelCalendar\Event
to add a getId()
method:
Additional Event Parameters
If you want to add additional parameters to your events, there are two options:
Using Calendar::event()
Pass an array of 'parameter' => 'value'
pairs as the 6th parameter to Calendar::event()
:
Add an getEventOptions
method to your event class
Create a Calendar
To create a calendar, in your route or controller, create your event(s), then pass them to Calendar::addEvent()
or Calendar::addEvents()
(to add an array of events). addEvent()
and addEvents()
can be used fluently (chained together). Their second parameter accepts an array of valid FullCalendar Event Object parameters.
Sample Controller code (Using Script Tags and Browser Globals)
Sample Controller code (Using ES6 build system)
Sample View (Using Script Tags and Browser Globals)
Then to display, add the following code to your View:
Sample View (Using ES6 build system)
In your /resources/js/app.js
add any necessary plugins after installing them with NPM.
In your resources/css/app.scss
add the necessary CSS.
Then in your blade view file output the HTML:
Notes
Note: The output from calendar()
and script()
must be non-escaped, so use {!!
and !!}
(or whatever you've configured your Blade compiler's raw tag directives as).
The script()
can be placed anywhere after calendar()
, and must be after fullcalendar was included.