abc/scheduler
Experimental PHP scheduler library for running jobs based on CRON expressions. Define schedule providers and processors via simple interfaces, bind them in a Scheduler, and execute due schedules with an included Symfony Console command (abc:schedule).
Artisan commands and schedule:run), but offers a more modular, interface-driven approach. This could be advantageous for teams requiring dynamic or runtime-defined schedules.ScheduleCommand can be directly integrated into Laravel’s Artisan CLI without major refactoring.ProviderInterface (schedule source) and ProcessorInterface (execution logic) enables flexible scheduling strategies (e.g., database-backed, API-driven, or hybrid schedules).cron parsing (via DateTime or libraries like cron-expression), which is compatible with Laravel’s schedule() syntax.ScheduleCommand can be registered in Laravel’s console/kernel.php alongside existing commands, with minimal boilerplate.schedule() sufficient?schedule:run + queue:work suffice, or does this package’s modularity justify the risk?Artisan CLI.cron-expression if needed).daily cleanup job to use php-scheduler with a ProviderInterface fetching tasks from a DB.ProviderInterface to fetch schedules (e.g., from a schedules table).ProcessorInterface to handle execution (e.g., dispatching Laravel jobs).ScheduleCommand in app/Console/Kernel.php:
protected function commands()
{
$this->commands([
\Abc\Scheduler\Symfony\ScheduleCommand::class,
]);
}
schedule:run calls with abc:schedule in deployment scripts.schedule:run and abc:schedule temporarily to validate parity.* * * * * for minute-level jobs). Validate against Laravel’s syntax if strict compatibility is needed.DateTime objects in providers/processors use Laravel’s configured timezone (e.g., via config('app.timezone')).try/catch to log failures (Laravel’s exception handler will catch unhandled errors).schedules table (if database-backed) with fields like expression, active, last_run_at./etc/crontab) once fully migrated.abc:schedule:status command).abc/scheduler for updates (though low activity increases risk of stagnation).composer.json to avoid surprises.ScheduleInterface).info("Processed schedule: {$schedule->getExpression()}")).debugbar or telescope to inspect scheduler activity.php artisan abc:schedule:run --once).cache()->lock() in processors.scheduler:cache table).ScheduleCommand during peak loads.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Cron parsing errors | Missed or misfired jobs | Validate expressions on provider save. |
| Provider DB connection issues | No schedules loaded | Retry logic in provider’s provideSchedules(). |
| Processor crashes | Job failures | Dispatch to Laravel queue with retry logic. |
| Time zone misconfiguration | Schedules run at wrong times | Enforce timezone in ProviderInterface. |
| Concurrent executions | Duplicate job runs | Use distributed locks in processors. |
| Package abandonment | Unmaintained code | Fork or replace if activity stalls. |
ProviderInterface/ProcessorInterface implementations.How can I help you explore Laravel packages today?