Download the PHP package ensi/laravel-initial-event-propagation without Composer

On this page you can find all versions of the php package ensi/laravel-initial-event-propagation. 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 laravel-initial-event-propagation

Laravel Initial Event Propagation

Latest Version on Packagist Tests Total Downloads

Provides a bunch of ready-to use middleware to integrate ensi/initial-event-propagation in Laravel application. You are free to replace any of them with your own implementations.

Installation

You can install the package via composer:

Publish config file like this:

Version Compatibility

Laravel IEP Laravel PHP
^0.1.0 ^8.x ^8.0
^0.2.0 ^8.x ^8.0
^0.2.5 ^8.x || ^9.x ^8.0
^0.2.6 ^8.x || ^9.x ^8.1
^0.2.9 ^8.x || ^9.x || ^10.x ^8.1
^0.2.11 ^8.x || ^9.x || ^10.x || ^11.x ^8.1
^0.3.0 ^9.x || ^10.x || ^11.x ^8.1

Basic Usage

You must always resolve InitialEventHolder from the service container instead of InitialEventHolder::getInstance. This is made forLaravel Octane compatibility.

HTTP Requests

Setting initial event

You typically create a new initial event when you receive a HTTP request coming from a client you do not own. E.g in an API Gateway.
There is a built-in Ensi\LaravelInitialEventPropagation\SetInitialEventHttpMiddleware for that.
It creates an InitialEventDTO and places it to the InitialEventHolder singleton.

Be sure to add the midlleware AFTER Laravel middleware that sets authenticated user.
In practice it likely means that you have to place the middleare at the very bottom of middlewareGroups in app/Http/Kernel

Parsing incoming initial event

Add Ensi\LaravelInitialEventPropagation\ParseInitialEventHeaderMiddleware to app/Http/Kernel middleware property.
This middleware parses X-Initial-Event HTTP header, deserializes it into InitialEventDTO object and places it to the InitialEventHolder singleton.

Propagating initial event to outcomming HTTP request

The package provides a Ensi\LaravelInitialEventPropagation\PropagateInitialEventLaravelGuzzleMiddleware Guzzle Middleware that converts resolve(InitialEventHolder::class)->getInitialEvent() back to X-Initial-Event header and sets this header for all outcomming guzzle request.

You can add it to your guzzle stack like this:

CLI

Artisan Commands

There is a custom artisan Ensi\LaravelInitialEventPropagation\SetInitialEventArtisanMiddleware that sets new initial event in every artisan command that you run. You can add it to the app\Console\Kernel like that:

This middleware sets artisan command name (including argument, excluding options) as $initialEventDTO->entrypoint.
If your custom artisan command makes guzzle HTTP requests to other apps the PropagateInitialEventGuzzleMiddleware uses this initial event.
This middleware also works fine for Laravel Task Scheduling.

Queue Jobs

You typically want to persist initial event between incoming HTTP request and queued job.
The package can help you here aswell. Unfortunately you need to touch a given job:

Laravel Queable Actions

If you use spatie/laravel-queueable-action package to dispatch actions instead of jobs you do not need to mess with every job separately.

Just publish laravel-queueable-action config and set the special Job class there:

Contributing

Please see CONTRIBUTING for details.

Testing

  1. composer install
  2. composer test

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

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


All versions of laravel-initial-event-propagation with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ensi/initial-event-propagation Version ^0.3.0
laravel/framework Version ^9.0 || ^10.0 || ^11.0
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 ensi/laravel-initial-event-propagation contains the following files

Loading the files please wait ....