Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Transactional Event Publisher

Laravel Transactional Event Publisher Laravel Package

softonic/laravel-transactional-event-publisher

A Laravel package that defers event publishing until database transactions commit, helping keep domain events consistent with persisted data and preventing listeners from reacting to uncommitted or rolled-back changes.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Laravel Transactional Event Publisher
What does softonic/laravel-transactional-event-publisher do?
It is a Laravel package that defers dispatching domain events until the surrounding database transaction commits. This prevents listeners from reacting to data that may still be rolled back and helps keep events consistent with persisted state.
How do I install softonic/laravel-transactional-event-publisher in Laravel?
Install it with Composer using composer require softonic/laravel-transactional-event-publisher. Laravel package discovery should register the service provider automatically; publish and adjust any configuration only if the repository README instructs you to.
Which Laravel and PHP versions does this package support?
Supported Laravel and PHP versions are defined in the package's composer.json and Packagist metadata. Check the repository README and release notes before upgrading, because constraints can change between major versions.
What happens if the database transaction rolls back?
When a transaction rolls back, deferred events tied to that transaction are not published. That avoids listeners seeing changes that were never persisted. Confirm the exact rollback behavior for nested transactions in the README.
Does it work with Laravel queued listeners and jobs?
Yes, once the event is published after commit, normal Laravel queued listeners and jobs can handle it as usual. The key benefit is that queued work is not dispatched for uncommitted or rolled-back data.
Can I use it with multiple database connections or nested transactions?
Multi-connection and nested transaction behavior depends on how your application opens transactions and how the package is configured. Review the README for supported connection handling before relying on it in complex transaction flows.
How do I test that events are published only after commit?
Use Laravel's Event::fake or a real listener spy, open a transaction, fire the event, and assert it is not handled before commit. Then commit and assert the listener runs; also test rollback to confirm no event is published.
Is this package a replacement for Laravel's event dispatcher or after-commit callbacks?
It is not a wholesale replacement for Laravel's event dispatcher; it adds transactional deferral around event publishing. Laravel also offers mechanisms such as ShouldHandleEventsAfterCommit and after-commit callbacks, so compare fit and maintenance before choosing.
What are the production considerations for transactional event publishing?
Keep transactions short, because events wait until commit and long transactions delay listener work. Remember that after-commit listener failures cannot roll back the already committed database changes, so add monitoring and idempotency where needed.
What alternatives exist to this package for Laravel transactional events?
Alternatives include Laravel's ShouldHandleEventsAfterCommit interface, after-commit callbacks, and transactional outbox patterns for stronger delivery guarantees. Evaluate the package's maintenance status and your consistency requirements before adopting it.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource