tjovaisas/delayed-event-bundle
Schedule Symfony events to dispatch later instead of immediately. This bundle queues delayed events and processes them when due, useful for reminders, time-based workflows, and background follow-up actions.
Bottom line: do not adopt this artifact. Harvest the ~150-line pattern and reimplement it. The package is a Symfony bundle, not a Laravel package, and it is effectively unmaintained.
Architecture fit
Bundle subclass + DI extension + compiler pass) around a Doctrine ORM postFlush event subscriber. Its job is to queue domain events during a unit of work and dispatch them after the flush completes, so listeners never trigger a nested flush.EventDispatcherInterface, Symfony's DI container, and Doctrine's EventManager. In Laravel, none of those are the native primitives: Laravel uses Illuminate\Contracts\Events\Dispatcher, its own service container, and (usually) Eloquent rather than Doctrine.EventManager from a service provider. At that point you are using maybe 20% of the package and inheriting 100% of the dependency constraints.Integration feasibility: low
symfony/* to ^3.4|^4.4|^5.x and PHP to 7.x/8.0. Laravel 10/11 pull Symfony 6/7 components. Expect a hard composer update conflict; resolving it means a fork.tjovaisas/delayed-event-bundle) does not match the referenced repo (tomas7777/lib-delayed-event-bundle) — classic republished-fork or rename pattern; provenance needs verification before any code review investment.Key questions to answer before any further evaluation (spike, ~1 day)
composer.json constraints for PHP, doctrine/orm, and symfony/event-dispatcher / dependency-injection / http-kernel?clear())?Stack fit
laravel-doctrine/orm), and a Symfony bundle on top of that is a third layer. Most Laravel teams should solve this problem with Eloquent-native tools.DB::afterCommit(fn () => ...) for closure-based deferral.$afterCommit = true / ShouldQueueAfterCommit for job dispatch post-commit.postFlush subscriber that drains a per-request queue into Laravel's dispatcher — this is the direct port of what the bundle does.Migration path (if a spike confirms the logic is small)
postFlush algorithm. Ignore the Symfony bundle scaffolding.App\Doctrine\DeferredEventSubscriber registered via EventManager::addEventSubscriber() in a service provider, dispatching through Illuminate\Contracts\Events\Dispatcher.DeferredEventBuffer as a singleton scoped to the request/job; expose dispatchAfterCommit(object $event).Doctrine\DBAL\Connection transaction state so the buffer is cleared on rollback, not just drained on flush.Compatibility
postFlush semantics and the EventArgs shape against the ORM version actually pinned.DateTime internals) is unlikely to have been addressed since 2022.Sequencing
Maintenance
Support
Scaling
postFlush dispatch is synchronous and runs inside the request/job lifecycle, after the DB commit but before the response. Long listener chains extend tail latency and hold the DB connection open past the transaction. Any listener doing I/O (mail, HTTP, cache bust) must be pushed to a queue.clear(). Need a flush-and-drain policy per batch, not per job.postFlush subscribers registered by other packages.Failure modes
clear() will hit EntityNotFoundException / detached-proxy errors.Ramp-up
dispatchAfterCommit as a general-purpose dispatch and reintroduce the bug the library exists to prevent. Mitigate with a code comment, an ADR, and a test that fails if a listener flushes.How can I help you explore Laravel packages today?