Getting Started
Installation
Install Calendary using Composer:
Then import the main class:
Creating a Calendar
Availability is loaded using Calendary::load():
$calendar = Calendary::load([
'weekly' => [
1 => [['09:00', '12:00'], ['14:00', '18:00']],
2 => [['09:00', '18:00']],
3 => [['09:00', '18:00']],
4 => [['09:00', '18:00']],
5 => [['09:00', '17:00']],
],
]);
Weekly availability uses ISO-8601 weekdays:
| Value | Day |
|---|---|
1 |
Monday |
2 |
Tuesday |
3 |
Wednesday |
4 |
Thursday |
5 |
Friday |
6 |
Saturday |
7 |
Sunday |
Configure the Calendar
duration() controls the length of each generated slot.
interval() controls the distance between candidate slot start times.
When no interval is configured, the duration is used as the interval.
Add Occupancy
Query a Date
You can then inspect the resolved result:
Or serialize it:
Query a Range
Ranges are inclusive.
A Typical Availability Query
For an API or booking interface, you may want only open days and available slots:
$result = $calendar
->query()
->available()
->availableSlots()
->select('date', 'slots')
->between(
'2026-10-05',
'2026-10-12'
);
return $result->toArray();
The same calendar can later be used to validate a requested booking: