Skip to content

Results

Calendary returns result objects rather than raw arrays.

The primary result types are:

Day
Slot
Range

Each implements the Result contract and supports:

$result->toArray();
$result->toJson();

They are also JSON serializable.

Day

A Day represents the resolved state of one calendar date.

$day->date();
$day->weekday();

$day->status();
$day->available();

$day->slots();
$day->availableSlots();

$day->isAvailable('10:00');

Day Statuses

Status Meaning
open At least one generated slot is available
closed No availability applies to the date
full Availability exists but all generated slots are busy
day_off The date is explicitly marked as a day off
holiday The date is explicitly marked as a holiday

Constants are available:

Day::OPEN;
Day::CLOSED;
Day::FULL;
Day::DAY_OFF;
Day::HOLIDAY;

Slot

A Slot represents one generated time period.

$slot->start();
$slot->end();

$slot->status();
$slot->available();

Slot statuses are:

available busy

Constants:

Slot::AVAILABLE;
Slot::BUSY;

start() and end() return DateTimeImmutable.

Range

A Range contains resolved days for a requested date range.

$range->from();
$range->to();
$range->days();

The requested range boundaries remain unchanged when filters are used.

For example:

$range = $calendar
    ->query()
    ->status('open')
    ->between(
        '2026-10-01',
        '2026-10-31'
    );

from() and to() still represent the requested October range, while days() contains only matching days.

Serialization

$data = $result->toArray();

Or:

$json = $result->toJson();

You may also use normal JSON serialization:

$json = json_encode(
    $result,
    JSON_THROW_ON_ERROR
);