Download the PHP package laraveljutsu/zap without Composer
On this page you can find all versions of the php package laraveljutsu/zap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laraveljutsu/zap
More information about laraveljutsu/zap
Files in laraveljutsu/zap
Package zap
Short Description A flexible, performant, and developer-friendly schedule management system for Laravel
License MIT
Informations about the package zap
Table of contents
- What is Zap?
- Installation
- Core concepts
- Quick start
- Schedule patterns
- Query & availability
- Real-world examples
- Configuration
- Advanced
- AI agent support
- Contributing
π― What is Zap?
Zap is a calendar and scheduling package for Laravel. Define availabilities, appointments, blocked times, and custom schedules for any resource (doctors, rooms, employees, etc.).
Use cases: appointment booking, healthcare resources, employee shifts, shared space booking.
π¦ Installation
Requirements: PHP β₯8.5 β’ Laravel β₯12.0
UUIDs/ULIDs: If your app uses non-integer primary keys, read Custom model support before migrating. You may need to change migrations and config.
Make a model schedulable: add the HasSchedules trait.
π§© Core concepts
| Type | Purpose | Overlaps |
|---|---|---|
| Availability | When a resource can be booked | Allowed |
| Appointment | Bookings / scheduled events | Exclusive |
| Blocked | When booking is forbidden | Exclusive |
| Custom | Your rules (overlap, etc.) | You define |
π Quick start
π‘ Use the
zap()helper instead of the facade when you prefer:zap()->for($doctor)->...
π Schedule patterns
Recurrence at a glance
| Pattern | Method / example |
|---|---|
| Daily | daily() |
| Weekly (days) | weekly(['monday', 'friday']) |
| Weekly + period | weekDays(['monday', 'friday'], '09:00', '17:00') |
| Odd/even weeks | weeklyOdd(), weeklyEven() (+ weekOddDays / weekEvenDays) |
| Bi-weekly | biweekly(['tuesday'], $startsOn?) |
| Monthly (dates) | monthly(['days_of_month' => [1, 15]]) |
| Bi-monthly / quarter / semi / annual | bimonthly(), quarterly(), semiannually(), annually() + config |
| Ordinal weekday | firstWednesdayOfMonth(), secondFridayOfMonth(), lastMondayOfMonth() |
| Every N weeks | everyThreeWeeks(), β¦ everyFiftyTwoWeeks() |
| Every N months | everyFourMonths(), β¦ everyElevenMonths() |
Recurrence examples
Daily & weekly
Monthly (by day of month)
Monthly ordinal weekday (1st, 2nd, 3rd, 4th, or last weekday of the month)
Dynamic intervals
Date ranges
Time periods
π Query & check availability
| Need | Method |
|---|---|
| Any bookable slot today? | $model->isBookableAt('2025-01-15', 60) |
| Time range bookable? | $model->isBookableAtTime('2025-01-15', '09:00', '09:30') |
| Time range bookable (custom slot)? | $model->isBookableAtTime('2025-01-15', '09:30', '10:00', null, 30) |
| Time range bookable (custom slot + buffer)? | $model->isBookableAtTime('2025-01-15', '09:45', '10:15', null, 30, 15) |
| List bookable slots | $model->getBookableSlots('2025-01-15', 60, 15) |
| Next bookable slot | $model->getNextBookableSlot('2025-01-15', 60, 15) |
| Conflicts for a schedule | Zap::findConflicts($schedule) / Zap::hasConflicts($schedule) |
| Schedules on a date | $model->schedulesForDate('2025-01-15')->get() |
| Schedules in range | $model->schedulesForDateRange('2025-01-01', '2025-01-31')->get() |
| By type | $model->appointmentSchedules(), availabilitySchedules(), blockedSchedules() |
| Schedule type checks | $schedule->isAvailability(), isAppointment(), isBlocked() |
β οΈ
isAvailableAt()is deprecated. PreferisBookableAt(),isBookableAtTime(), andgetBookableSlots().
πΌ Real-world examples
Doctor
Meeting room
Employee (with vacation)
βοΈ Configuration
Publish assets:
Important keys in config/zap.php: time_slots.buffer_minutes, default_rules.no_overlap, conflict_detection, validation.
π‘οΈ Advanced features
Custom schedules & rules
Metadata
Validation rules: noOverlap(), allowOverlap(), workingHoursOnly('09:00', '17:00'), maxDuration(120), noWeekends().
Custom model support (UUIDs)
If your app uses UUIDs/ULIDs for primary keys:
- Models β Extend
Zap\Models\ScheduleandZap\Models\SchedulePeriod, add LaravelβsHasUuidstrait. AddHasUuidsto your schedulable model (e.g.Doctor) as well. - Config β In
config/zap.php, setmodels.scheduleandmodels.schedule_periodto your extended classes. - Migrations β After publishing, change
id()touuid('id')->primary(),morphs('schedulable')touuidMorphs('schedulable'), andforeignId('schedule_id')toforeignUuid('schedule_id')in the schedules and schedule_periods tables.
Do this before running migrations.
π§ AI agent support
Zap provides Laravel Boost 2.0 skills. With Boost installed, agents get accurate knowledge of the API.
| Skill | Contents |
|---|---|
zap-schedules |
Types, builder API, validation, conflict detection |
zap-availability |
Bookable slots, availability checks, querying |
zap-recurrence |
All recurrence patterns (daily, weekly, odd/even, monthly, ordinal weekday, dynamic) |
No extra configuration.
π€ Contributing
Contributions are welcome. Use PSR-12 and add tests.
π License
MIT License.
π Security
Report issues to [email protected] (not the public issue tracker).
All versions of zap with dependencies
ext-intl Version *