Managing schedules, appointments, and time-based events in web applications can be surprisingly complex. Whether you're building a doctor's appointment system, managing meeting rooms, or handling employee shifts, you need a robust solution that integrates seamlessly with Laravel's ecosystem. Enter Laravel Zap – a powerful, flexible, and developer-friendly schedule management package that makes temporal operations feel effortless.
Laravel Zap is a comprehensive schedule management system designed specifically for Laravel applications. It provides a fluent API for creating, managing, and querying schedules while offering advanced features like conflict detection, recurring patterns, and availability management. With deep Laravel integration including Eloquent relationships, events, and configuration, Zap feels like a natural extension of the framework.
Laravel Zap leverages Laravel's Eloquent ORM with a clean HasSchedules
trait that you can add to any model. This means your users, resources, or any other entity can have schedules with full relationship support.
use Zap\Models\Concerns\HasSchedules;
class User extends Authenticatable
{
use HasSchedules;
// Now your users can have schedules!
}
One of Zap's standout features is its intelligent conflict detection system. It automatically prevents double-bookings and overlapping schedules with customizable buffer times and strict mode validation.
Support for daily, weekly, monthly, and custom recurring patterns makes it easy to handle complex scheduling scenarios like:
Built on Laravel's Carbon library, Zap provides robust date/time manipulation with full timezone support, making it perfect for global applications.
Getting started with Laravel Zap is straightforward:
# Install the package
composer require laraveljutsu/zap
# Publish and run migrations
php artisan vendor:publish --tag=zap-migrations
php artisan migrate
# Optionally publish configuration
php artisan vendor:publish --tag=zap-config
use Zap\Facades\Zap;
$user = User::find(1);
$appointment = Zap::for($user)
->named('Doctor Appointment')
->description('Annual checkup')
->from('2025-03-15')
->addPeriod('09:00', '10:00')
->save();
$meeting = Zap::for($user)
->named('Team Standup')
->from('2025-01-01')
->to('2025-12-31')
->addPeriod('09:00', '09:30')
->weekly(['monday', 'wednesday', 'friday'])
->save();
$schedule = Zap::for($user)
->named('Client Meeting')
->from('2025-03-15')
->addPeriod('14:00', '16:00')
->noOverlap() // Prevent conflicts
->workingHoursOnly('09:00', '18:00') // Business hours only
->maxDuration(240) // Max 4 hours
->withMetadata([
'location' => 'Conference Room A',
'priority' => 'high'
])
->save();
One of Zap's most powerful features is its availability system:
// Check if someone is available
$available = $user->isAvailableAt('2025-03-15', '14:00', '16:00');
// Get all available time slots for a day
$slots = $user->getAvailableSlots(
date: '2025-03-15',
dayStart: '09:00',
dayEnd: '17:00',
slotDuration: 60 // 60-minute slots
);
// Find the next available slot
$nextSlot = $user->getNextAvailableSlot(
afterDate: '2025-03-15',
duration: 120, // 2 hours needed
dayStart: '09:00',
dayEnd: '17:00'
);
// Set up doctor availability
$availability = Zap::for($doctor)
->named('Available Hours')
->from('2025-03-01')->to('2025-03-31')
->addPeriod('09:00', '12:00')
->addPeriod('14:00', '17:00')
->weekly(['monday', 'tuesday', 'wednesday', 'thursday', 'friday'])
->save();
// Book patient appointment with conflict prevention
$appointment = Zap::for($doctor)
->named('Patient Consultation')
->from('2025-03-15')
->addPeriod('10:00', '10:30')
->noOverlap()
->save();
// Schedule recurring maintenance
$maintenance = Zap::for($room)
->named('Monthly Maintenance')
->from('2025-03-01')
->addPeriod('18:00', '20:00')
->monthly(['day_of_month' => 1])
->save();
// Book meeting room with metadata
$meeting = Zap::for($room)
->named('Board Meeting')
->from('2025-03-15')
->addPeriod('09:00', '11:00')
->noOverlap()
->withMetadata([
'organizer' => 'john@company.com',
'equipment' => ['projector', 'whiteboard']
])
->save();
// Set up regular work schedule
$workSchedule = Zap::for($employee)
->named('Regular Shift')
->from('2025-01-01')->to('2025-12-31')
->addPeriod('09:00', '17:00')
->weekly(['monday', 'tuesday', 'wednesday', 'thursday', 'friday'])
->noWeekends()
->save();
Laravel Zap comes with extensive configuration options:
// config/zap.php
return [
'default_rules' => [
'no_overlap' => true,
'working_hours' => [
'enabled' => false,
'start' => '09:00',
'end' => '17:00',
],
'max_duration' => [
'enabled' => false,
'minutes' => 480,
],
],
'conflict_detection' => [
'enabled' => true,
'buffer_minutes' => 0,
'strict_mode' => true,
],
'cache' => [
'enabled' => true,
'ttl' => 3600,
'prefix' => 'zap_schedule_',
],
];
Laravel Zap is built with performance in mind:
Laravel Zap is available under the MIT license and ready for production use. With comprehensive documentation, extensive testing, and a clean API, it's the perfect solution for any Laravel application that needs robust schedule management.
The package has already gained traction in the Laravel community with 44 stars on GitHub and is actively maintained. Whether you're building a small appointment booking system or a complex enterprise scheduling platform, Laravel Zap provides the foundation you need.
Visit the GitHub repository to explore the code, contribute, or report issues. The Laravel community continues to benefit from packages like Zap that solve real-world problems with elegant, Laravel-idiomatic solutions.
Laravel Zap represents the best of what makes Laravel great: elegant syntax, powerful features, and developer happiness. Give it a try in your next project that needs scheduling capabilities – your future self will thank you.