laraveljutsu/zap
Zap adds flexible calendar scheduling to Laravel: manage resource availabilities, appointments, blocked times, and custom schedules (doctors, rooms, staff). Includes patterns plus querying/availability checks for booking, shifts, and shared spaces.
Strengths:
noOverlap(), maxDuration()).patient_id, organizer), enabling downstream integrations (e.g., CRM, billing).getBookableSlots(), isBookableAtTime(), and schedulesForDateRange() simplify frontend/UX logic (e.g., "show available 30-minute slots").Weaknesses:
Pros:
HasSchedules trait enables incremental adoption (e.g., add scheduling to Doctor model without touching other models).Zap::for($model) and zap()->... provide fluent syntax familiar to Laravel devs.spatie/laravel-schedule).Cons:
schedules, schedule_periods, schedule_metadata) and indexes, requiring schema migrations.SoftDeletes trait (workaround: extend Schedule model).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Schema Conflicts | Medium | Review existing migrations; use --force cautiously. |
| Performance | Low | Indexes on schedulable_id, type, and starts_at are auto-created. For high-volume systems, test schedulesForDateRange() with large datasets. |
| Recurrence Edge Cases | Medium | Test ordinal weekdays (e.g., "last Monday") and custom intervals (e.g., everyFiveMonths()) in your timezone. |
| Concurrency | Low | Use Laravel’s queue system for appointment creation to avoid race conditions. |
| Upgrade Path | Low | Semantic versioning; breaking changes are rare (e.g., v1.13.0 added ordinal weekdays without BC). |
| AI Agent Reliability | Low | Boost skills are pre-trained but may miss niche use cases; validate with your AI agent. |
Primary Use Case:
Data Model:
Schedule model to support SoftDeletes.Scalability:
Frontend Integration:
react-big-calendar.Customization Needs:
Schedule model or use metadata.Team Skills:
Laravel-Centric: Zap is optimized for Laravel 13+ and leverages:
HasSchedules trait).ZapServiceProvider).zap()->for($model)).PHP 8.5+ Features: Uses named arguments, enums (internally), and modern type hints.
Database Agnostic: Works with MySQL, PostgreSQL, SQLite, etc., but assumes standard Laravel database conventions.
Compatibility Notes:
Pre-Integration:
composer.json meets PHP 8.5+ and Laravel 13+ requirements.HasSchedules (e.g., Doctor, Room, Employee).Installation:
composer require laraveljutsu/zap
php artisan vendor:publish --provider="Zap\ZapServiceProvider" --tag=zap-migrations
php artisan vendor:publish --provider="Zap\ZapServiceProvider" --tag=zap-config
Database Migration:
php artisan migrate
schedules, schedule_periods, and schedule_metadata tables.schedulable_id, type, and starts_at for performance.Model Integration:
Add the HasSchedules trait to your models:
use Zap\Models\Concerns\HasSchedules;
class Doctor extends Model
{
use HasSchedules;
}
Configuration:
config/zap.php:
time_slots.buffer_minutes: Adjust buffer time for bookable slots (default: 15).default_rules.no_overlap: Set to false if overlaps are allowed.conflict_detection: Enable/disable overlap checks.Testing:
Doctor::getBookableSlots()).How can I help you explore Laravel packages today?