Skip to content

Extension points

phil/reservation

The library is plain PHP: it declares no service, and its classes are final. What an application chooses goes through two ports and through arguments.

PointHow
When a resource is openImplement Phil\Reservation\Contract\Availability: the open spans that meet a period, in order, those that touch joined; holidays, opening hours kept elsewhere, a shared schedule
What a booking must followImplement Phil\Reservation\Contract\Rule: a holder's quota, a role, a price; it returns a Violation or null
What a booking is checked againstThe Bookings passed to check(), free() and slots(): the application decides which count, confirmed ones and holds not expired
Moving a bookingThe $replacing identifier of BookingRequest and free()
The clockThe $requestedAt of BookingRequest and the $now of slots() and ReminderSchedule::due(): the library never reads the time itself
Messages, in any languageWritten by the application from ViolationCode's values and each violation's parameters; the library writes none
How many slots are readThe $limit of slots(), within Bookable::MAX_SLOTS
Catching the library's errorsEvery exception implements Phil\Reservation\Exception\ReservationException

A rule of its own receives the request and the resource's time zone, and keeps no state between calls, so that one Bookable serves every request of a long-running worker.