dbh/symfony-schedule-bundle
Pros:
dailyAt, cron, etc.), making it familiar for Laravel developers transitioning to Symfony.schedule.yaml aligns with Symfony’s bundle-based architecture, reducing hardcoded cron entries.ManagerInterface allows custom logic (e.g., logging, validation, or dynamic scheduling) before job execution.Cons:
Console component). Laravel integration would require abstraction (e.g., wrapping Symfony’s Application or using a facade).artisan schedule:run. This bundle lacks equivalent built-in runners.* * * * * php /path/to/bin/console schedule:run). No auto-discovery of Laravel’s schedule:run equivalent.Laravel Compatibility:
Schedule class methods (dailyAt, cron, etc.) mirror Laravel’s API, easing migration for developers.schedule:run)..env variables).artisan schedule:run with a custom Symfony command calling the ScheduleManager.Console component or use a bridge (e.g., symfony/console in Laravel via Composer).Technical Risks:
Console component may clash with Laravel’s Illuminate/Console.scheduling:running). This bundle lacks event hooks.laravel/schedule).withoutOverlapping)?SCHEDULE_TIME) be handled? Laravel uses .env; Symfony may require custom config.laravel-log.spatie/scheduler) or serverless alternatives (e.g., AWS EventBridge).Console is already in use.symfony/console (for command execution), symfony/yaml (for config).symfony/lock (for concurrency), monolog/monolog (for logging).Phase 1: Proof of Concept
composer require dbh/symfony-schedule-bundle symfony/console
// app/Facades/SymfonySchedule.php
namespace App\Facades;
use Dbh\Symfony\ScheduleBundle\Model\ManagerInterface;
use Illuminate\Support\Facades\Facade;
class SymfonySchedule extends Facade {
protected static function getFacadeAccessor() { return 'symfony.schedule'; }
}
// app/Providers/SymfonyScheduleServiceProvider.php
use Dbh\Symfony\ScheduleBundle\DbhSymfonyScheduleBundle;
public function register() {
$this->app->register(DbhSymfonyScheduleBundle::class);
$this->app->bind('symfony.schedule', function($app) {
return new App\Model\ScheduleManager(); // Implement ManagerInterface
});
}
Phase 2: CRON Integration
schedule:run with a custom command:
php artisan make:command SymfonyScheduleRun
// app/Console/Commands/SymfonyScheduleRun.php
use Symfony\Component\Console\Application;
use Dbh\Symfony\ScheduleBundle\Model\ManagerInterface;
public function handle(ManagerInterface $manager) {
$application = new Application();
$application->add(new \Symfony\Component\Console\Command\Command('schedule:run'));
$manager->schedule(new \Dbh\Symfony\ScheduleBundle\Model\Schedule());
// Execute CRON jobs via Symfony's Application
}
app/Console/Kernel.php:
protected function schedule(Schedule $schedule) {
// Use SymfonySchedule facade instead of Laravel's $schedule
SymfonySchedule::schedule($schedule);
}
Phase 3: Feature Parity
LockFactory to replicate withoutOverlapping.scheduling:running) from the ScheduleManager.Schedule class to support Laravel’s timezone handling.| Feature | Laravel Native | Symfony Bundle | Workaround Needed? |
|---|---|---|---|
| CRON syntax | ✅ Yes | ✅ Yes | No |
schedule:run |
✅ Yes | ❌ No | Custom command |
| Locking | ✅ Yes | ❌ No | Symfony LockFactory |
| Environment variables | ✅ Yes | ❌ No | Custom config loader |
| Events | ✅ Yes | ❌ No | Manual event dispatching |
| Timezones | ✅ Yes | ❌ No | Extend Schedule class |
schedule() to the Symfony bundle’s ScheduleManager.symfony-schedule:run CRON entry.schedule.yaml, reducing deployment errors.ManagerInterface implementations allow adding pre/post-job logic (e.g., logging, retries).Console component changes).dailyAt, cron) reduces onboarding time.Console component.php artisan schedule:list equivalent).laravel-horizon or laravel-telescope).monolog or Laravel’s log channel. Cross-stack logging may need unification.failed_jobs table).How can I help you explore Laravel packages today?