December 7, 2025

Zap: A Full Scheduling Engine for Laravel

package
Zap: A Full Scheduling Engine for Laravel

Zap is a lightweight scheduling system for Laravel that lets you manage availabilities, appointments, blocked times, and custom schedules for any resource (doctors, employees, rooms, etc.). It gives you a clean API for building booking and calendar features without reinventing time-slot logic.

You can find the package on Laravel Hub: Zap for Laravel


Example Usage

Define working hours, block specific times, and create appointments:

use Zap\Facades\Zap; // Define availability Zap::for($doctor) ->named('Office Hours') ->availability() ->forYear(2025) ->addPeriod('09:00', '12:00') ->addPeriod('14:00', '17:00') ->weekly(['monday', 'tuesday', 'wednesday', 'thursday', 'friday']) ->save(); // Block lunch break Zap::for($doctor) ->named('Lunch Break') ->blocked() ->forYear(2025) ->addPeriod('12:00', '13:00') ->weekly(['monday', 'tuesday', 'wednesday', 'thursday', 'friday']) ->save(); // Create an appointment Zap::for($doctor) ->named('Consultation') ->appointment() ->from('2025-01-15') ->addPeriod('10:00', '11:00') ->withMetadata(['patient_id' => 1]) ->save();

Retrieve bookable time slots:

$slots = $doctor->getBookableSlots('2025-01-15', 60, 15); $next = $doctor->getNextBookableSlot('2025-01-15', 60, 15);

Installation

composer require laraveljutsu/zap php artisan vendor:publish --tag=zap-migrations php artisan migrate

Add scheduling capability to a model:

use Zap\Models\Concerns\HasSchedules; class Doctor extends Model { use HasSchedules; }

Key Features

  • Full availability + appointment management
  • Overlap-aware system (availability allows overlaps; appointments and blocks don’t)
  • Custom scheduling rules
  • Clean fluent API
  • Works with any Eloquent model

Did you find this article helpful? Share it!