PHPackages                             jeromejhipolito/laravel-saga - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jeromejhipolito/laravel-saga

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jeromejhipolito/laravel-saga
============================

Laravel package for Saga transaction pattern - manage distributed transactions with automatic rollback support

v1.0.0(5mo ago)312[1 issues](https://github.com/jeromejhipolito/laravel-saga/issues)MITPHPPHP ^8.2

Since Jan 20Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/jeromejhipolito/laravel-saga)[ Packagist](https://packagist.org/packages/jeromejhipolito/laravel-saga)[ RSS](/packages/jeromejhipolito-laravel-saga/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Saga
============

[](#laravel-saga)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e05b7fcd15b5120c8061c0f2a82b7e0f86d7506d11b70429d686ea7d3526fb15/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a65726f6d656a6869706f6c69746f2f6c61726176656c2d736167612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeromejhipolito/laravel-saga)[![Total Downloads](https://camo.githubusercontent.com/d761c78bbd8b9b0c72363b73530406fd8684da1bdfb1939016bcd23e34a42867/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a65726f6d656a6869706f6c69746f2f6c61726176656c2d736167612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeromejhipolito/laravel-saga)

Laravel package for implementing the **Saga transaction pattern** - manage distributed transactions with automatic rollback support.

Features
--------

[](#features)

- **Step-by-step execution** - Execute multiple steps in sequence with automatic tracking
- **Automatic rollback** - When a step fails, previously executed steps are automatically rolled back in reverse order
- **Database persistence** - Transaction and step states are persisted for debugging and recovery
- **Status tracking** - Detailed status enums for both transactions and steps
- **Easy integration** - Simple trait for Jobs and Consumers

Installation
------------

[](#installation)

```
composer require jeromejhipolito/laravel-saga
```

Publish and run the migrations:

```
php artisan vendor:publish --tag="saga-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

### Creating a Saga Step

[](#creating-a-saga-step)

Create a step by extending `AbstractSagaStep`:

```
