, (*1)
Documentation is still in development., (*2)
Introduction
Building a calendar can be troublesome, especially when you deal with recurring events. This package tries to solve this problem by making an easy to use event builder with extensibility.
, (*3)
The package is made for Laravel and uses Laravel Collections extensively., (*4)
For installing the package, just run and you are good to go., (*5)
$ composer require uruloke/lara-calendar
The service providers is autoloaded, so enjoy!, (*6)
Example
Let's say we want to create an event which repeats every Monday, Tuesday, Wednesday and Thursday.
We can generate this simply by doing the following:, (*7)
$builder = new EventBuilder();
$builder->startsAt(Carbon::parse("2017-09-05 08:00"));
$builder->endsAt(Carbon::parse("2017-09-05 18:00"));
$builder->weekly([Monday::class, Tuesday::class, Wednesday::class, Thursday::class]);
// Dump the results
$builder->getNextEvents(3)
The dumped data for the next 3 events would then be:, (*8)
Uruloke\LaraCalendar\EventCollection {#221
#items: array:3 [
0 => Uruloke\LaraCalendar\Models\Event {#225
#start: Uruloke\LaraCalendar\Carbon {#230
+"date": "2017-09-05 08:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
#ends: Uruloke\LaraCalendar\Carbon {#231
+"date": "2017-09-05 18:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
}
1 => Uruloke\LaraCalendar\Models\Event {#232
#start: Uruloke\LaraCalendar\Carbon {#233
+"date": "2017-09-06 08:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
#ends: Uruloke\LaraCalendar\Carbon {#234
+"date": "2017-09-06 18:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
}
2 => Uruloke\LaraCalendar\Models\Event {#235
#start: Uruloke\LaraCalendar\Carbon {#236
+"date": "2017-09-07 08:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
#ends: Uruloke\LaraCalendar\Carbon {#237
+"date": "2017-09-07 18:00:00.000000"
+"timezone_type": 3
+"timezone": "UTC"
}
}
]
}
Recurrences
Weekly
BiWeekly
EvenWeeks
UnevenWeeks
Filters
Filter days out
There might be a specific day which you want to blacklist from your event. This can be achieved by using the withoutDay method.
Just parse in a day and it will ignore that specific day., (*9)
$builder = new EventBuilder();
$builder->startsAt(Carbon::parse("2017-09-05 08:00"));
$builder->endsAt(Carbon::parse("2017-09-05 18:00"));
$builder->allWeekDays();
$builder->withoutDay(Carbon::parse("2017-09-07"));