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

Cadence Laravel Package

directorytree/cadence

Cadence adds model-based scheduling to Laravel. Attach one or more cron or RRULE schedules to any Eloquent model, track due runs, and dispatch events when schedules trigger. Driver-based design supports cron, php-rrule, Recurr, or custom drivers.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

Cadence aligns well with Laravel’s Eloquent-centric and event-driven architecture, making it ideal for applications requiring model-specific scheduling (e.g., user notifications, report generation, compliance checks). Its driver-based design (cron/RRULE) ensures flexibility without vendor lock-in, while the polymorphic schedulable relationship enables seamless integration with existing models. The package leverages Laravel’s queue system and event listeners, reducing boilerplate for async execution.

Key Synergies:

  • Eloquent Integration: Native support for HasSchedules trait and polymorphic relations.
  • Event System: ScheduleTriggered events decouple scheduling from business logic, enabling async processing (queued jobs, notifications).
  • Timezone Awareness: Carbon-based timezone handling aligns with Laravel’s globalization needs.
  • Extensibility: Custom drivers and tap() methods allow domain-specific adaptations (e.g., business rule-based scheduling).

Integration Feasibility

Low-Medium Effort:

  • Core Setup: Requires publishing migrations, adding the schedules:run command to routes/console.php, and implementing Schedulable on target models (~2–4 hours for a TPM to coordinate).
  • Event Listeners: Minimal boilerplate for handling triggered schedules (e.g., dispatching jobs, sending emails).
  • Driver Dependencies: Optional but recommended (e.g., php-rrule for RRULE support). Cron is pre-required via Laravel core.

Compatibility:

  • Laravel 11+: Fully compatible; leverages modern features like model events and queue improvements.
  • PHP 8.2+: No breaking changes expected for supported versions.
  • Database: Single migration for the schedules table (no schema conflicts with existing apps).

Technical Risk

Risk Area Severity Mitigation
Performance at Scale Medium Pre-computed next_run_at optimizes queries, but high-volume schedules may require indexing or batching.
Timezone Edge Cases Low Carbon handles DST transitions, but custom logic may be needed for niche regions.
Event Listener Complexity Low Event discovery reduces boilerplate; shouldQueue() enables granular control.
Driver Dependencies Low Optional drivers (e.g., php-rrule) are well-maintained; cron is core.
Migration Upgrades Low Versioned migrations (e.g., disabled_at in v1.1.0) are backward-compatible.
Concurrency Medium withoutOverlapping() in schedules:run prevents race conditions, but custom drivers must handle thread safety.

Critical Questions for TPM:

  1. Scalability Needs: How many schedules/models will be active concurrently? (e.g., 10K vs. 100K).
  2. Recurrence Complexity: Will RRULE be needed for advanced patterns (e.g., "every 3rd Friday"), or is cron sufficient?
  3. Deployment Model: Is the Laravel app always running (e.g., shared hosting), or is serverless/distributed scheduling required?
  4. Observability: How will triggered schedules be monitored/logged? (e.g., Laravel Horizon, custom metrics).
  5. Custom Logic: Are there domain-specific scheduling rules that would require a custom driver?
  6. Timezone Strategy: Will schedules be model-specific (e.g., user timezone) or app-wide?
  7. Queue Backpressure: How will failed jobs (e.g., ScheduleTriggered listeners) be retried/alerted?

Integration Approach

Stack Fit

Cadence is optimized for Laravel’s native stack:

  • Database: Uses Eloquent models and a single schedules table (no ORM conflicts).
  • Queues: Leverages Laravel’s queue system for async event handling (e.g., ShouldQueue listeners).
  • Events: Integrates with Laravel’s event system for decoupled execution.
  • Artisan: Provides schedules:run command for CLI-driven execution.
  • Timezones: Native Carbon support for timezone-aware scheduling.

Non-Laravel Considerations:

  • PHP 8.2+: Required for modern features (e.g., enums, attributes).
  • Dependencies: Optional but recommended (e.g., php-rrule for RRULE). Cron is pre-included via Laravel.

Migration Path

Phase Tasks Effort Dependencies
Discovery Audit existing cron jobs/events to identify model-specific scheduling candidates. Low Business teams
Setup Install package, publish migrations, add schedules:run to routes/console.php. Medium DevOps (for cron setup)
Model Integration Implement Schedulable on target models (e.g., Report, Subscription). Low Backend devs
Driver Configuration Choose/cfg drivers (cron/RRULE) and install optional deps (e.g., php-rrule). Low Package manager
Event Listeners Create listeners for ScheduleTriggered (e.g., dispatch jobs, send emails). Medium Backend/Queue devs
Testing Validate schedules fire correctly (unit/integration tests for drivers, listeners). High QA/Backend
Deployment Schedule schedules:run in deployment pipeline (e.g., every minute via cron or Laravel Forge). Low DevOps
Observability Add logging/monitoring for triggered schedules (e.g., Laravel Horizon, Datadog). Medium Observability team

Sequencing Recommendations:

  1. Pilot with Low-Risk Models: Start with non-critical models (e.g., Report) to validate integration.
  2. Driver First: Choose cron for simplicity or RRULE for complex recurrence early in the process.
  3. Event-Driven Last: Implement listeners after core scheduling is working to isolate issues.
  4. Performance Test: Load-test with expected schedule volume before full rollout.

Compatibility

Component Compatibility Notes
Laravel 11.x+ (tested). Avoid pre-11 due to event/queue changes. Use composer require laravel/framework:^11.0.
PHP 8.2+ (required). No polyfills needed.
Databases MySQL, PostgreSQL, SQLite (Eloquent-supported). No schema conflicts.
Queue Drivers All Laravel-supported (database, redis, etc.). Async listeners work with any driver.
Timezones All IANA timezones (Carbon-supported). Test edge cases (e.g., DST transitions).
Custom Drivers Extendable via Schedule base class. Requires PHP 8.2+ features (e.g., enums).

Potential Conflicts:

  • Existing Cron Jobs: May need to migrate static cron jobs to model-based schedules.
  • Legacy Event Listeners: Ensure ScheduleTriggered listeners don’t conflict with existing event handlers.
  • Queue Workers: High schedule volume may require scaling queue workers (e.g., Horizon).

Operational Impact

Maintenance

Aspect Impact Mitigation
Migrations Minimal; single schedules table. Use Laravel’s migration rollback for changes.
Driver Updates Optional dependencies (e.g., php-rrule) may require updates. Monitor Packagist for breaking changes.
Schedule Management Manual via code (e.g., addSchedule()) or admin UI (if built). Consider a custom admin panel for non-dev users.
Timezone Changes Requires updating schedules if timezone rules change (e.g., DST policy updates). Document timezone strategies per model.
Custom Drivers May need updates if underlying libraries change (e.g., Recurr). Isolate custom logic in feature branches.

Support

Issue Type Likelihood Resolution Path
Schedules Not Firing Medium Check schedules:run command execution, next_run_at timestamps, and timezone.
Event Listener Failures High Use Laravel’s queue failure channels (e.g., database, Slack) and retry logic.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky