effiana/cron
A Laravel package for managing and running cron-style scheduled tasks within your application. Define jobs, configure timing, and trigger execution from the CLI or scheduler, providing a simple way to centralize recurring task automation in Laravel.
effiana/cron package provides a Laravel wrapper for cron-like job scheduling, abstracting the native Linux cron syntax into a more PHP-friendly API. This is valuable for applications requiring programmatic job scheduling (e.g., delayed tasks, recurring jobs) without relying on external cron daemons or queue workers like Laravel’s built-in schedule:run.Illuminate\Bus\Queueable), events, or custom logic.schedule:run, this package does not natively integrate with Laravel’s queue system (e.g., dispatch()). Jobs must be manually triggered or rely on external processes.DateTime and CronExpression (from dragonmantank/cron-expression). Ensure compatibility with Laravel’s PHP version (e.g., 8.0+).dragonmantank/cron-expression).schedule() lacks?schedule:run + queues instead).effiana/cron to test:
// Old cron syntax: * * * * * command
// New API:
$cron = new \Effiana\Cron\Cron('0 * * * *'); // Runs at minute 0
$cron->addJob(new MyJob());
php artisan my:cron-poller
pcntl or posix extensions are available if using multi-process polling.dragonmantank/cron-expression to a stable version (e.g., ^9.0) to avoid breaking changes.effiana/cron instances.cache:lock for critical jobs.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Cron expression syntax error | Job never runs | Validate expressions in tests/pre-commit. |
| Polling process crashes | Missed job executions | Use Laravel’s supervisor or systemd to restart the poller. |
| Database/dependency outage | Jobs fail silently | Implement retry logic with exponential backoff. |
| Timezone misconfiguration | Jobs run at wrong times | Enforce UTC in cron expressions and logs. |
| Race conditions (multi-server) | Duplicate job execution | Use distributed locks (e.g., Redis). |
How can I help you explore Laravel packages today?