Download the PHP package webrek/saga without Composer

On this page you can find all versions of the php package webrek/saga. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package saga

Saga

Latest Version Tests PHP

Run multi-step processes and, if one fails midway, undo the previous ones through their compensation — in reverse order. The saga pattern, for when an operation touches several services and there's no database transaction that spans them all.

A framework-independent core (plain PHP) with an optional Laravel bridge (Eloquent journal, events, facade).

Completes webrek's resilience quartet: input (idempotency) · output (outbox) · dependencies (circuit-breaker) · and coordination (this one).

Installation

On Laravel, the service provider is auto-discovered. Publish the journal migration:

How it runs

Steps execute in order. A SagaContext (a bag of data) is passed to each step: what one step writes, the next — and the compensations — read.

If a step throws an exception, the already completed steps are compensated in reverse order and the saga ends with one of three statuses:

Status Meaning
Completed All steps ran successfully.
Compensated A step failed and everything before it was undone cleanly.
CompensationFailed A step failed and a compensation did too — left half-done, requires manual intervention.

The result never swallows the original exception ($resultado->failure), and the CompensationFailed statuses are exactly the ones worth watching ($resultado->needsAttention()).

The journal (Laravel)

Every run is recorded in the sagas table: name, status, completed steps, context, the step that failed and compensation errors. It's your audit trail and, above all, the way to find the sagas whose compensation failed. Each run also dispatches an event (SagaCompleted, SagaCompensated, SagaCompensationFailed).

Disable it with 'journal' => false in the configuration.

Without Laravel

For your own events or persistence, implement Webrek\Saga\Contracts\EventDispatcher and Webrek\Saga\Contracts\SagaStore and pass them to the SagaRunner.

Scope

This is a synchronous, in-process orchestration saga: it runs inside your request or your job. It's not a two-phase commit, and it doesn't retry steps on its own — if you need retries, combine it with Laravel's queue or with webrek/laravel-circuit-breaker inside a step. Compensations must be idempotent.

Testing

The core suite (tests/Unit) runs without a framework; the Laravel suite (tests/Feature) exercises the Eloquent journal.

Contributing

See CONTRIBUTING.md. Run make check before opening a pull request.

Security

Report vulnerabilities through the security advisory form, not as public issues. See SECURITY.md.

License

The MIT License (MIT). See LICENSE.


All versions of saga with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webrek/saga contains the following files

Loading the files please wait ...