bookingbat/engine

A framework for defining recurring windows of availability, and "subtracting" bookings/appointments from them.

0.2.0 2013-06-23 17:11 UTC

This package is not auto-updated.

Last update: 2024-04-22 12:15:50 UTC


README

Latest Stable Version Total Downloads Build Status

Introduction

A framework for defining recurring windows of availability, and "subtracting" bookings/appointments from them. Has features for multiple windows of availability within one day, automatically 'fixes' overlapping windows, and can enforce padding between bookings.

Example

Lets set the availability window from 9-11am, and 11:30am-4pm

$availability = new Availability(array(
    array(
        'start' => '09:00:00',
        'end' => '11:00:00'
    ),
    array(
        'start' => '11:30:00',
        'end' => '16:00:00'
    ),
));

Now we'll add a booking from 3:30-4pm & get back the adjusted availability

$newAvailability = $availability->addBooking(array(
    'start' => '15:30',
    'end' => '16:00'
));

$newAvailability will show the actual availability is 9-11am, and 11:30-3:30pm:

array(
    array(
        'start' => '09:00:00',
        'end' => '11:00:00'
    ),
    array(
        'start' => '11:30:00',
        'end' => '15:30:00'
    ),
);