Download the PHP package andydefer/laravel-roster without Composer
On this page you can find all versions of the php package andydefer/laravel-roster. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andydefer/laravel-roster
More information about andydefer/laravel-roster
Files in andydefer/laravel-roster
Package laravel-roster
Short Description Clean and flexible scheduling for Laravel applications.
License MIT
Informations about the package laravel-roster
Laravel Roster
Roster is a comprehensive Laravel package for advanced scheduling, availability, and booking management. Built with a robust architecture, it handles recurring availability, booked slots, and impediments with exhaustive business validation.
๐ฆ Installation
Publish package resources:
Or manually:
๐ Quick Start
1. Add the trait to your models
2. Create recurring availabilities
3. Schedule appointments
4. Manage temporary unavailability
5. Search for available slots
๐ก๏ธ Performance Protection: Absolute Minimum Duration
To prevent infinite loops and performance degradation, Roster enforces an absolute minimum duration of 10 minutes for ALL entity types (Availability, Schedule, Impediment).
Why 10 minutes?
When searching for available slots, the system generates time slots based on the duration. A duration that is too small would generate an enormous number of iterations:
| Duration | Generated Slots (1 year) | Performance Impact |
|---|---|---|
| 1 minute | ~525,600 slots | ๐ด Infinite loop risk - System overload, memory exhaustion |
| 5 minutes | ~105,120 slots | ๐ Very slow - Timeout possible, poor user experience |
| 10 minutes | ~52,560 slots | ๐ข Optimal - Fast and stable |
| 15 minutes | ~35,040 slots | ๐ข Excellent - Best performance |
| 30 minutes | ~17,520 slots | ๐ข Perfect - Maximum efficiency |
Technical Protection Implementation
The protection is enforced at the lowest level of the validation system:
What happens if you try to configure less than 10 minutes?
Validation in Action
๐ Polymorphic Scheduling Link System
Roster includes an advanced system that allows any Eloquent model to be associated with schedules with customizable metadata.
Attach resources to schedules
Manage attached resources
Direct usage from models
Eloquent relationships
Advanced use cases
1. Operating room management
2. Shared resource booking
3. Complex metadata for tracking
๐ Model Query Methods (HasRoster Trait)
The HasRoster trait includes methods to retrieve impediments and schedules of a model within a given period.
Added Methods
Simple Example
Practical Use Case
๐ Core Concepts
Immutability Principle
Roster prevents direct model mutations to ensure data integrity. All operations must go through appropriate services:
Single-action context
Each service is designed for a single action with its own context:
The 3 main entities
- Availability: Defines when a resource is available (days, times, period)
- Schedule: Represents a booked slot in an availability
- Impediment: Temporarily blocks an availability
๐ก๏ธ Secure Architecture
Mutation access control
The system uses two contexts to control access:
Secure helpers
The availability_for(), schedule_for(), and impediment_for() helpers automatically create the necessary context:
๐ Advanced Search and Data Consistency
first() method for targeted search
Automatic days consistency
The system automatically ensures consistency between specified days and validity periods:
Standardized days sorting
Utility functions always return days in standard week order (Monday โ Sunday):
๐ฏ Exhaustive Business Validation
Roster includes 17 validation rules that guarantee system consistency:
Main rules:
- SchedulableValidationRule (110) - Checks for schedulable context presence
- RequiredFieldsRule (100) - Validates required fields per operation
- AvailabilityTemporalCoherenceRule (100) - Ensures temporal coherence
- TemporalConflictRule (80) - Prevents scheduling overlaps
- AvailabilityOverlapRule (80) - Prevents availability overlaps
- TimeRangeRule (85) - Validates time ranges (no multi-day spans)
- DurationRule (90) - Enforces minimum duration (with 10 minutes absolute minimum)
Rule visualization:
๐ Real-world Usage Examples
Medical clinic management
Room booking system
Recurrent impediment management
๐ง Complete API
Availability Service
Schedule Service
Impediment Service
โ๏ธ Configuration
Configuration file (config/roster.php)
Environment variables
๐งช Comprehensive Tests
The package includes 2300 tests covering all scenarios:
Tested scenarios:
- โ Full availability lifecycle
- โ Impediment management with conflicts
- โ Intelligent booking system
- โ Complex interactions (availabilities + impediments + schedules)
- โ Multi-user conflicts with shared resources
- โ Error handling and edge cases
- โ Performance testing with massive data
- โ Recovery after errors
- โ Realistic complex scenario (hospital with multiple specialists)
- โ Data consistency with automatic reconciliation
- โ
first()method for targeted search - โ Polymorphic link system with metadata
- โ Attached resource management (rooms, vehicles, equipment)
- โ Synchronization and detachment tests
- โ Minimum duration enforcement (10 minutes absolute minimum)
- โ Protection against infinite loops in slot generation
๐จ Error Handling
Duration validation error example
Reconciliation warning handling
๐ Development Tools
Validation rule debugging
Cache management
๐ค Contribution
- Fork the repository
- Create a branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Run tests
๐ License
This package is open-source and available under the MIT license.
๐ Useful Links
- API Documentation
- Migration Guide
- Changelog
- Issues
Roster - A professional solution for advanced scheduling management, designed for critical applications where every minute counts. โ๏ธโฐโจ
With advanced search features, data consistency, exhaustive business validation, automatic protection against infinite loops (10 minutes absolute minimum duration), and a comprehensive polymorphic link system, Roster ensures the integrity of your scheduling systems in the most demanding environments.
All versions of laravel-roster with dependencies
illuminate/support Version ^12.0
laravel/framework Version ^12.0
php Version ^8.2