dukecity/command-scheduler-bundle
Symfony bundle to schedule console commands with cron expressions. Manage native and custom commands, backed by database storage and optional Doctrine migrations. Supports modern PHP/Symfony versions; see wiki for configuration, execution, and upgrade notes.
Console\CommandLoader) and Doctrine ORM for persistence. This aligns well with Symfony’s ecosystem, reducing friction for teams already using these components.crontab syntax, which is familiar to developers managing scheduled tasks. The use of cron expressions (* * * * * *) provides flexibility for time-based triggers.BaseScheduledCommand and ScheduledCommandInterface allow customization (e.g., adding metadata like customField), enabling domain-specific extensions without forking the bundle.SchedulerCommandFailedEvent) for failed executions, enabling integration with monitoring/logging systems (e.g., Sentry, ELK).CommandLoader to auto-discover commands, reducing manual configuration. Non-Symfony console commands (e.g., custom CLI tools) would require explicit registration./command-scheduler admin interface (requires ROLE_ADMIN). Useful for non-technical stakeholders but adds a frontend dependency (Bootstrap 5).make:migration, doctrine:migrations:migrate) and may conflict with existing schemas if not carefully managed.CronExpression). For high-frequency schedules, consider a dedicated queue (e.g., Symfony Messenger + cron) to offload execution.DateTime). Test coverage may need expansion for edge cases (e.g., DST transitions).exec() calls).ROLE_ADMIN the correct access control for scheduling? May need RBAC adjustments for multi-tenant apps.pdo, intl for cron parsing).at, or manual scripts) to identify candidates for migration.composer config extra.symfony.allow-contrib true
composer require dukecity/command-scheduler-bundle
ROLE_ADMIN route protection).php bin/console make:migration
php bin/console doctrine:migrations:migrate
CronExpression assertions (e.g., assertTrue($expression->isDue())).doctrine/dbal, doctrine/orm) matches the bundle’s requirements.DateTime and Intl (for locale-aware expressions). Verify these are enabled.APP_ENV vs. shell variables).* * * * * * for seconds granularity).priority, timeout) via entity extension.BaseScheduledCommand, ensure migrations are run for new fields and validate backward compatibility.SchedulerCommandFailedEvent logs and the admin UI for errors.bin/console debug:command).supervisord) to run schedules.isDue() checks may stress the DB. Optimize with:
scheduled_at and status fields.pcntl_fork) for parallel command execution, but monitor resource usage.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Database downtime | Missed schedules |
How can I help you explore Laravel packages today?