Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

colinlongworth's avatar

Rules based Booking / Calendar Availability?

Before sitting down to write what I think will be a very complex rules engine, I wanted to check if a package (or best practice) exists for doing the following:

Let's assume I have a timestamp and I want to check this against a group of rules that a user can set up in advance:

  • By time e.g. I do not accept bookings between 2 pm and 4 pm
  • By date range e.g. I am not accepting bookings between May 1st and May 15th
  • By date with time range e.g. I am not accepting bookings between 9 am and 5 pm on June 15th
  • By month e.g. I am not accepting bookings between April and July
  • By day e.g. I am not accepting bookings on Fridays

Note, a user could set up multiple rules e.g. I do not accept bookings on Wednesday AND between 9 am and 11 am.

The excepted output is true or false, either the input timestamp is 'bookable' or it is not.

So, the question:

  • Is there a best practice for this?
  • Are there any packages or case studies that demo this type of functionality?
  • Would RRULE be of assistance here?
0 likes
1 reply
jlrdw's avatar

Are there any packages or case studies that demo this type of functionality?

Yes there are some on Github, not saying use one, but you could look over the code.

In one I did years ago, I just had slots to fill.

Please or to participate in this conversation.