phil / reservation-bundle
Bookable resources in Symfony: reservations held, booked, moved and cancelled without double booking, free slots, expiring holds and reminders via Messenger.
Package info
github.com/parler-haut-interagir-librement/reservation-bundle
Type:symfony-bundle
pkg:composer/phil/reservation-bundle
Requires
- php: >=8.5
- ext-mbstring: *
- doctrine/dbal: ^4.5
- doctrine/orm: ^3.7
- phil/reservation: ^0.1@dev
- psr/clock: ^1.0
- psr/event-dispatcher: ^1.0
- symfony/config: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/form: ^8.2
- symfony/options-resolver: ^8.2
- symfony/polyfill-php86: ^1.37
- symfony/translation-contracts: ^3.6
- symfony/uid: ^8.2
Requires (Dev)
- doctrine/doctrine-bundle: ^3.3
- doctrine/persistence: ^4.1
- phil/calendar-bundle: ^0.1@dev
- phil/recurrence-bundle: ^0.1@dev
- phpunit/phpunit: ^13.4
- symfony/clock: ^8.2
- symfony/console: ^8.2
- symfony/event-dispatcher: ^8.2
- symfony/event-dispatcher-contracts: ^3.6
- symfony/framework-bundle: ^8.2
- symfony/http-kernel: ^8.2
- symfony/messenger: ^8.2
- symfony/process: ^8.2
- symfony/translation: ^8.2
Suggests
- phil/calendar-bundle: To show the confirmed reservations in the calendar's views
- symfony/console: For phil:reservation:expire-holds and phil:reservation:send-reminders
- symfony/messenger: To send the reminders as messages the application handles
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-21 03:04:52 UTC
README
Reservations for Symfony: resources and their reservations in Doctrine, booked one request at a time per resource.
phil/reservation-bundle keeps bookable resources and their reservations in Doctrine, and books them with the rules,
buffers, hours and conflicts of phil/reservation. A request is held for a few minutes or booked at once; it runs
under its resource's lock, so that two requests never take the last unit together. A hold is confirmed or expires;
a reservation is moved, resized or cancelled; the free slots of a period are listed. The reservation form gives every
reason a request would be refused, in the reader's language. The holds that expire and the reminders due are handled
by two commands, the reminders going out as Messenger messages, and the confirmed reservations appear in the views of
phil/calendar-bundle.
It is the core of every booking an application offers: rooms, tables and people directly, and appointments, equipment rental, lodging, a game library's loans or escape-room sessions as thin uses on top. It stores identifiers of holders, never their names or addresses.
Status
| Part | State |
|---|---|
BookableResource and Reservation in Doctrine, moments in UTC |
Implemented and tested, on SQLite, MySQL 8.4 and PostgreSQL 17 |
| People booked as resources, like rooms and tables | Implemented and tested |
| The resource's lock under concurrent requests | Tested with processes racing for the last unit on MySQL and PostgreSQL |
Reservations: check, hold, book, confirm, reschedule, cancel, slots, expired holds |
Implemented and tested |
Reminders and the Messenger sender |
Implemented and tested |
ReservationType and the messages of the reasons, in English and French |
Implemented and tested |
| The commands, the calendar's item source | Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, registering the bundle, the schema. |
| Configuration | The options of phil_reservation. |
| Resources | BookableResource: capacity, buffers, rules, hours, reminders, holds, people. |
| Reservations | Reservations: holding, booking, confirming, moving, cancelling, the lock, the events. |
| Forms and messages | ReservationType and ViolationMessages. |
| Holds and reminders | The commands, Reminders, the Messenger message. |
| The calendar | The confirmed reservations in phil/calendar-bundle's views. |
| Extension points | The ports, events and options an application chooses or replaces, and the uses built on the bundle. |
| Testing | The bundle's tests, its integration suite on MySQL and PostgreSQL, and its mutation bar. |
| Reference | Every type of the bundle, with its role. |
Quick start
composer require phil/reservation-bundle
use Phil\ReservationBundle\Application\Exception\ReservationRefused; use Phil\ReservationBundle\Application\Reservations; use Phil\ReservationBundle\Infrastructure\Translation\ViolationMessages; public function book(Reservations $reservations, ViolationMessages $messages, string $tableId): Response { try { $hold = $reservations->hold($tableId, new DateTimeImmutable('2026-11-10 19:00'), new DateTimeImmutable('2026-11-10 22:00'), 4, $accountId); } catch (ReservationRefused $refused) { return $this->render('booking/refused.html.twig', ['reasons' => $messages->messages($refused->decision)]); } // … payment, then: $reservations->confirm($hold->id); }
Requirements
PHP 8.5 or later, Symfony 8.2 or later, Doctrine ORM 3.7 and DBAL 4.5 or later. symfony/console, symfony/messenger and
phil/calendar-bundle are optional.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.