{"repo":"fntneves/laravel-transactional-events","free":true,"listed":false,"github":"https://github.com/fntneves/laravel-transactional-events","clone":"git clone https://github.com/fntneves/laravel-transactional-events.git","description":"Transaction-aware Event Dispatcher for Laravel","language":"PHP","stars":319,"topics":["laravel","package","transactional","events","dispatcher","php"],"license":"MIT","category":"databases-storage","readme_excerpt":"Transaction-aware Event Dispatcher for Laravel This Laravel package introduces Transaction-aware Event Dispatcher. It ensures the events dispatched within a database transaction are dispatched only if the outer transaction successfully commits. Otherwise, the events are discarded and never dispatched. Note: Laravel 8.17 introduced a new method DB::afterCommit that allows one to achieve the same of this package. Yet, it lacks transaction-aware behavior support for Eloquent events. Table of Contents Motivation Installation Laravel Lumen Usage Configuration F.A.Q. Motivation Consider the following example of ordering tickets that involves changes to the database. The orderTickets dispatches the custom OrderCreated event. In turn, its listener sends an email to the user with the order details. In the case of transaction failure, due to an exception in the orderTickets method or even a deadlock, the database changes are completely discarded. Unfortunately, this is not true for the already dispatched OrderCreated event. This results in sending the order confirmation email to the user, even after the order failure. The purpose of this package is thus to hold events dispatched within a database transaction until it successfully commits. In the above example the OrderCreated event would never be dispatched in the case of transaction failure. Installation Laravel Package Notes :--------- :---------- :---------- 5.8.x-7.x 1.8.x 8.x-12.x 2.x 2.1.x requires PHP 8+ Laravel - Install this p","default_branch":null,"files":null,"tree":[],"storefront":"/r/fntneves","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/fntneves/laravel-transactional-events/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}