- Can I use symfony/scheduler in a Laravel application?
- Yes, you can install it with Composer, but it is built for Symfony Messenger and has no native Laravel integration. You would need to configure Messenger transports, buses, and workers, and rewrite scheduled tasks around ScheduleProviderInterface or #[AsCronTask]. Laravel's own scheduler is usually a better fit unless you already use Symfony Messenger.
- How do I install symfony/scheduler in Laravel?
- Install it with Composer alongside symfony/messenger, then configure a Messenger transport and worker. You must register your schedule provider or use cron task attributes and ensure the scheduler runs with Messenger. There is no Artisan command that automatically wires it into Laravel's schedule:run workflow.
- What Laravel versions does symfony/scheduler support?
- It does not publish Laravel-specific version support because it is a Symfony component. Compatibility depends on your PHP version and the Symfony components already required by your Laravel app. Check Composer constraints carefully to avoid conflicts with Symfony packages used by Laravel.
- How does symfony/scheduler compare to Laravel's built-in scheduler?
- Laravel's scheduler uses cron plus artisan schedule:run and offers Schedule::call, Schedule::job, timezone support, and Horizon/Nova visibility. Symfony Scheduler dispatches messages through Messenger and uses checkpoints for recurring tasks. For most Laravel teams, the native scheduler is simpler and better integrated.
- Do I lose Horizon and Telescope monitoring if I use symfony/scheduler?
- You do not automatically lose them, but Symfony Scheduler will not appear in Horizon or Telescope without custom instrumentation. Failed cron tasks and scheduler checkpoints are not surfaced in those Laravel tools by default. You would need separate logging, monitoring, and alerting for Messenger workers and scheduled messages.
- How are recurring tasks defined with symfony/scheduler?
- Tasks are typically defined with #[AsCronTask] attributes or by implementing ScheduleProviderInterface. The scheduler computes due messages and dispatches them through Symfony Messenger. In Laravel this means moving away from the familiar artisan schedule: syntax.
- What infrastructure do I need to run symfony/scheduler in production?
- You need Messenger transports, at least one Messenger worker, and the scheduler process that generates due messages. Checkpoints for recurring tasks are stored in cache or database, so that backing store must be reliable. This adds operational overhead alongside Laravel queue workers and cron.
- Can symfony/scheduler handle time zones and dynamic schedules?
- Symfony Scheduler supports cron-style schedules and its own trigger/provider mechanisms, but it does not provide Laravel's dynamic Schedule::call or Schedule::job conveniences. Time-zone-aware behavior must be configured and verified in your implementation. If you rely heavily on Laravel's scheduling API, migration requires refactoring.
- How should I test scheduled tasks if I use symfony/scheduler?
- Test the message dispatch and handler behavior through Symfony Messenger's testing utilities rather than Laravel's scheduler fakes. You can assert that due messages are dispatched and that consumers handle them correctly. Laravel-specific testing helpers for schedule:list or artisan schedule:run will not cover Symfony Scheduler tasks.
- Is symfony/scheduler a good alternative to Laravel's scheduler?
- It is a reasonable alternative only if you already use Symfony Messenger or need its scheduling model. Otherwise it introduces dual infrastructure, migration effort, and weaker Laravel ecosystem integration. Laravel's native scheduler or Laravel-focused packages are usually lower risk.