Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Zap Laravel Package

laraveljutsu/zap

Zap is a Laravel scheduling package to manage availabilities, appointments, blocked times, and custom schedules for any resource (doctors, rooms, employees). Query availability, prevent overlaps, and build booking, shift, or shared space workflows.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Strengths:

    • Domain-Specific Abstraction: Zap provides a clean, Laravel-native abstraction for calendar/scheduling logic, reducing boilerplate for appointment systems, resource booking (e.g., meeting rooms, healthcare), and shift management.
    • Flexible Recurrence Patterns: Supports 10+ recurrence types (daily, weekly, monthly ordinals, bi-weekly, etc.), covering 90% of real-world scheduling needs without custom code.
    • Conflict Detection: Built-in overlap validation for appointments, availabilities, and blocked times, with configurable rules (e.g., noOverlap(), maxDuration()).
    • Metadata Support: Attach arbitrary data to schedules (e.g., patient_id, organizer), enabling downstream integrations (e.g., CRM, billing).
    • Query Optimization: Methods like getBookableSlots() and isBookableAtTime() are optimized for performance, critical for UI responsiveness in booking flows.
    • AI Integration: Laravel Boost compatibility ensures seamless AI agent interactions (e.g., for dynamic scheduling queries).
  • Weaknesses:

    • Tight Coupling to Laravel Ecosystem: Relies heavily on Laravel features (e.g., Eloquent, Facades, Artisan), making it less portable to non-Laravel PHP apps.
    • UUID/ULID Complexity: Custom model support for non-integer IDs adds migration overhead (requires pre-migration config changes).
    • Limited Asynchronous Support: No built-in event dispatching or queueing for schedule changes (e.g., sending notifications when appointments are booked).

Integration Feasibility

  • Stack Compatibility:

    • PHP 8.5+: Leverages modern PHP features (e.g., enums, attributes) but avoids breaking changes for older versions.
    • Laravel 13+: Optimized for Laravel’s latest conventions (e.g., model binding, service containers). Backward compatibility with Laravel 10/11 is untested but likely possible with minor tweaks.
    • Database: Assumes MySQL/PostgreSQL (standard Laravel support). No NoSQL or specialized DB requirements.
    • Frontend: Agnostic; works with any frontend (React, Vue, Livewire, Inertia) via API endpoints or direct model queries.
  • Migration Path:

    • Low Risk: Installation is straightforward (composer require, php artisan migrate), with minimal config changes for default use cases.
    • High Risk: Custom ID types (UUIDs/ULIDs) require pre-migration setup (model extensions, migration adjustments).
    • Data Migration: Existing appointment systems can be mapped to Zap’s models (Availability, Appointment, Blocked), but schema alignment may need custom scripts.

Technical Risk

  • Critical Risks:

    • Timezone Handling: Incorrect timezone configurations (e.g., server vs. user timezones) can cause schedule misalignment. Zap normalizes timezones internally but requires explicit config (e.g., config('app.timezone')).
    • Performance at Scale: Heavy usage (e.g., 10K+ schedules per resource) may require query optimization (e.g., indexing schedulable_id, type, and date fields).
    • Concurrency: No built-in locking for concurrent bookings. Race conditions could occur if multiple users book the same slot simultaneously.
  • Mitigation Strategies:

    • Timezones: Enforce consistent timezone usage across the app (e.g., UTC for storage, user-local for display).
    • Performance: Add database indexes for schedulable_id, type, and start_at/end_at columns. Consider caching frequent queries (e.g., getBookableSlots()).
    • Concurrency: Implement application-level locks (e.g., Laravel’s Lock facade) for critical booking operations.
  • Key Questions:

    1. Primary Use Case: Is this for appointment booking (e.g., healthcare), resource allocation (e.g., meeting rooms), or shift management (e.g., employees)? This dictates feature prioritization (e.g., metadata for appointments vs. team assignments for shifts).
    2. Concurrency Needs: Will high-traffic scenarios (e.g., public booking portals) require additional locking mechanisms?
    3. Custom Rules: Are there business-specific scheduling rules (e.g., "no double-booking for the same patient") that Zap’s validation doesn’t cover?
    4. Legacy Data: How will existing schedules (if any) be migrated to Zap’s models?
    5. AI/Automation: Will AI agents (e.g., Laravel Boost) interact with schedules dynamically (e.g., auto-rescheduling)?

Integration Approach

Stack Fit

  • Laravel-Centric: Zap is designed for Laravel’s ecosystem, leveraging:
    • Eloquent Models: Extends Laravel’s ORM for schedules and periods.
    • Service Providers: Registers Facades (Zap, zap()) and publishes migrations/config.
    • Artisan Commands: Includes CLI tools for migration/publishing.
    • Validation: Integrates with Laravel’s validator for custom rules (e.g., noOverlap()).
  • Frontend Agnostic: Works with any frontend via:
    • API Routes: Expose getBookableSlots, createAppointment endpoints.
    • Livewire/Inertia: Direct model interactions for real-time updates.
    • GraphQL: Can be wrapped in a Laravel GraphQL schema (e.g., with Lighthouse).

Migration Path

  1. Assessment Phase:
    • Audit existing scheduling logic (e.g., custom tables, cron jobs, manual tracking).
    • Identify gaps in Zap’s feature set (e.g., lack of recurring event editing).
  2. Pilot Implementation:
    • Start with a single resource type (e.g., doctors for a healthcare app).
    • Use Zap’s HasSchedules trait on the model and test core flows (availability, booking, conflicts).
  3. Incremental Rollout:
    • Phase 1: Replace static schedules (e.g., office hours) with Zap’s availability().
    • Phase 2: Migrate dynamic bookings (e.g., appointments) to appointment().
    • Phase 3: Integrate blocked times (e.g., vacations, maintenance) via blocked().
  4. Data Migration:
    • Write scripts to transform legacy data into Zap’s models:
      // Example: Convert old appointments to Zap appointments
      foreach ($legacyAppointments as $appointment) {
          Zap::for($doctor)
              ->named($appointment->title)
              ->appointment()
              ->from($appointment->date)
              ->addPeriod($appointment->start_time, $appointment->end_time)
              ->withMetadata($appointment->metadata)
              ->save();
      }
      

Compatibility

  • Database: Works with Laravel’s default migrations. For UUIDs:
    • Extend Zap\Models\Schedule and Zap\Models\SchedulePeriod.
    • Update migrations to use uuid() instead of bigIncrements().
  • Laravel Versions: Officially supports Laravel 13+. For Laravel 10/11:
    • Test compatibility or patch minor version mismatches (e.g., Facade syntax).
  • Third-Party Packages:
    • Calendar Libraries: Integrates with frontend calendars (e.g., FullCalendar) via API endpoints.
    • Notification Services: Pair with Laravel Notifications for appointment reminders.
    • Payment Gateways: Use metadata to link appointments to invoices (e.g., metadata['invoice_id']).

Sequencing

  1. Setup:
    • Install package and publish migrations/config:
      composer require laraveljutsu/zap
      php artisan vendor:publish --provider="Zap\ZapServiceProvider" --tag="zap-migrations"
      php artisan vendor:publish --provider="Zap\ZapServiceProvider" --tag="zap-config"
      
    • Configure config/zap.php (timezones, buffer minutes, conflict rules).
  2. Model Integration:
    • Add HasSchedules trait to resource models (e.g., Doctor, Room).
    • Run migrations:
      php artisan migrate
      
  3. Core Features:
    • Implement availability (e.g., office hours).
    • Add blocked times (e.g., lunch breaks, vacations).
    • Build appointment creation logic.
  4. Advanced Features:
    • Custom validation rules (e.g., maxDuration()).
    • Metadata-driven workflows (e.g., linking appointments to users).
    • AI agent integration (if using Laravel Boost).
  5. Testing:
    • Unit tests for schedule creation/validation.
    • Integration tests for booking flows.
    • Load tests for high-concurrency scenarios.

Operational Impact

Maintenance

  • Pros:
    • Active Development: Regular updates (last release in 2026) and community engagement (GitHub stars, Laravel Boost support).
    • MIT License: No vendor lock-in; can fork or modify if needed.
    • Documentation: Comprehensive README, release notes, and AI agent skills for quick onboarding.
  • Cons:
    • **Dependency Risk
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui