Download the PHP package lukaszaleckas/laravel-correlation-id without Composer

On this page you can find all versions of the php package lukaszaleckas/laravel-correlation-id. 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-correlation-id

Laravel Correlation ID

This package offers a way to correlate all the operations performed on request, asynchronous ones like jobs included.

Correlation id is generated or set from request header, if it has one (header name is specified in config), and appended to every log context.

Installation

  1. Run composer require lukaszaleckas/laravel-correlation-id
  2. (optional) Publish correlation_id.php config: php artisan vendor:publish --tag=laravel-correlation-id if you want to customize the default parameters
  3. (optional) Add LaravelCorrelationId\Jobs\Traits\RecallsCorrelationId trait to your jobs if you want correlation id to be automatically saved on job dispatch and recalled before it is handled / processed.

Usage

Firstly, you should inject LaravelCorrelationId\CorrelationIdService service.

Current correlation id can be accessed by calling service's getCurrentCorrelationId method.

This package extends Laravel's default Dispatcher class so that the correlation ID could be set before the job is dispatched, and recalled before it is processed.

This package adds LaravelCorrelationId\Http\Middleware\CorrelationIdMiddleware middleware to the global middleware stack by default. If you want to add the middleware to specific routes/groups on your own, you can disable this behaviour by setting CORRELATION_ID_INCLUDE_ROUTE_MIDDLEWARE environment variable to false.

Note on jobs

If you are mocking Laravel's Dispatcher::class in your tests, you should update them to mock this package's JobDispatcher class:

Note on Guzzle

If you are using Guzzle and want to pass the correlation ID from one application to another, you will find the \LaravelCorrelationId\Utils\GuzzleUtils\ class useful. It exposes 2 methods:

Using these methods will ensure that the client passes the correlation ID header and value to another application.

Upgrading

From 1.x to 2.x

These versions should not have any breaking changes. However, version 2.x deprecates the \LaravelCorrelationId\Jobs\Middleware\RecallCorrelationIdMiddleware and \LaravelCorrelationId\Jobs\Contracts\AbstractCorrelatableJob classes.

If you still use them, please consider upgrading to use the new \LaravelCorrelationId\Jobs\Traits\RecallsCorrelationId job trait.

Version 2.x also automatically adds the \LaravelCorrelationId\Http\Middleware\CorrelationIdMiddleware as a global middleware, so you no longer have to manually do that.


All versions of laravel-correlation-id with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
laravel/framework Version ^9.0|^10.0|^11.0
guzzlehttp/guzzle Version ^7.5
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 lukaszaleckas/laravel-correlation-id contains the following files

Loading the files please wait ....