robertbaelde/notificationtransactions

Ability to wait with sending notifications until a specific action completes

1.0.1 2020-02-03 14:38 UTC

This package is auto-updated.

Last update: 2024-04-29 04:27:03 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

This package holds off the sending of notifications until the transactions is commit. This is usefull if you trigger notifications inside a database transaction for example.

Installation

You can install the package via composer:

composer require robertbaelde/notificationtransactions

Usage

 // Start a transaction 
 NotificationTransaction::start();
 
 // Trigger your notifications as usual 
 $user->notify(new ImportantNotification());
 
 // commit the notifications when you want to send them
 \NotificationTransaction::commit();
 
  // rollback the notifications when something failed and notifications must not be send. 
  \NotificationTransaction::rollback();
 
 // You can also use DI instead of the Facade. 
 $notificationTransaction = resolve(NotificationTransaction::class);
 $notificationTransaction->start();

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email robert@baelde.nl instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.