NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #3466 most downloaded on Packagist
Transaction-aware Event Dispatcher for Laravel
Latest stable
2.4.0
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 1.3 years
Most releases are documented
notes for 27 of 34 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
34 releases · first in 2017
Drag across the ruler to compare, or tap a release to open it.
Add Laravel 12 support
Add Laravel 11 support
Add Laravel 10 support
Your coding agent can read these notes before it upgrades. Set up the MCP server →
- Add Laravel 9 support - Drop PHP 7 support
Use Dispatcher contract in constructor
Add support for Laravel 8 (see #43)
transactional namespaced helper.Use Dispatcher contract in constructor
Added the transactional namespaced helper.
transactional namespaced helper.Removed the transactional helper. See #39
transactional helper. See #39Alternatively, use TransactionalClosureEvent directly.
Event::dispatch(new TransactionalClosureEvent(function () {
// Job will be dispatched only if the transaction commits.
ProcessOrderShippingJob::dispatch($order);
});
This version includes the transactional helper to bring transactional behavior to custom instructions.
This version includes the transactional helper to bring transactional behavior to custom instructions.
It is particularly useful for dispatching jobs:
transactional(function () {
ProcessPodcast::dispatch($podcast);
});
Remove "final" keyword from TransactionalDispatcher class
TransactionalDispatcher classNothing published for this version
Update phptree package dependency
Fix exception when transaction life-cycle events are no registered.
Add DatabaseTransactions helper trait
DatabaseTransactions helper trait (https://github.com/fntneves/laravel-transactional-events/pull/28)Fix dispatcher not registering when db is already resolved
Changed public API of dispatcher
Semantic versioning according to Laravel version
Semantic versioning according to Laravel version
Nothing published for this version
Add check for non-prepared connections
Add support for db driver extension
Keep the payload context in dispatched events
This release introduces a new trait useful only for versions before `Laravel 5.6.16` (see [#23832](https://github.com/laravel/framework/pull/23832)).
This release introduces a new trait useful only for versions before Laravel 5.6.16 (see #23832).
The custom RefreshDatabase trait disables the dispatch of the events related to transactions used to reset your database. This is motivated by the fact that they interfere with the behavior of your application during tests.
In order to take advantage of this trait, replace the original Illuminate\Foundation\Testing\RefreshDatabase with Neves\Testing\RefreshDatabase in your test classes.
This releases introduces a change for the issue described below:
This releases introduces a change for the issue described below:
When you are testing your application, perhaps you refresh your database either rollbacking and migrating your database migrations (fast for in-memory databases such as SQLite) or using database transactions that are created before each test and rollbacked at the end of it.
If you are using an non-in-memory database, such as PostgreSQL or MySQL, you will figure out that your transactional events are never dispatched. Why? Since this package dispatches events only after the outer transaction commits, your events are never dispatched since your test is running within a transaction that you do not control.
This release now allows this package to manage the transactional level internally according to the events that it actually receives. It allows this package to work properly when events are not triggered but the transaction level in Laravel is greater than 0.
⚠️⚠️⚠️However... It does not solve the fact that the RefreshDatabase trait dispatches events. I have introduced an issue in Laravel internals repository to discuss this. For now, if you are using PostgreSQL and MySQL databases, you must disable the TransactionBeginning event while the outer transaction (the one that cover each test method) starts. To do so, you can use this Github gist: https://gist.github.com/fntneves/7f0b99767fce369919211148942eb297
This release introduces Lumen compatibility.
This release introduces Lumen compatibility.
Thanks to @Szasza, the composer.json dependencies were replaced with the minimal required packages, so this package can be installed in Lumen also:
"illuminate/database": "5.5.* || 5.6.*""illuminate/events": "5.5.* || 5.6.*""illuminate/support": "5.5.* || 5.6.*"Ensure composer.json includes the following requirements:
Ensure composer.json includes the following requirements:
Otherwise it could be installed on previous versions and they are not compatible.
This release adds the contract Neves\Events\Contracts\TransactionalEvent.
This release adds the contract Neves\Events\Contracts\TransactionalEvent.
When events implement this contract, they will become transactional.
Please note that this contract overrides the configuration, i.e., the events that implement this contract will behave as transactional events even when present in the excluded array.
Here's in an example:
namespace App\Events;
use Illuminate\Queue\SerializesModels;
use Illuminate\Foundation\Events\Dispatchable;
...
use Neves\Events\Contracts\TransactionalEvent;
class TicketsOrdered implements TransactionalEvent
{
use Dispatchable, InteractsWithSockets, SerializesModels;
...
}
This release contains the following changes:
This release contains the following changes:
$halt set to true now bypass the transactional layer, since caller is waiting for the result and it is often used in *ing (like booting and updating) events.excluded config key:'excluded' => [
// 'eloquent.*',
'eloquent.booted',
'eloquent.retrieved',
'eloquent.created',
'eloquent.saved',
'eloquent.updated',
'eloquent.created',
'eloquent.deleted',
'eloquent.restored',
],
Bug fixes:
The following Model events are now considered transactional events: ` eloquent.booting eloquent.booted eloquent.retrieved eloquent.saved eloquent.upda
The following Model events are now considered transactional events:
eloquent.booting
eloquent.booted
eloquent.retrieved
eloquent.saved
eloquent.updated
eloquent.created
eloquent.deleted
eloquent.restored
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.