dkx/monolog-psr-http-request-processor

This package is abandoned and no longer maintained. No replacement package was suggested.

Monolog processor for PSR HTTP request

1.0.0 2019-09-26 13:59 UTC

This package is auto-updated.

Last update: 2024-01-26 23:17:20 UTC


README

Monolog processor for PSR Http requests

Installation

$ composer require dkx/monolog-psr-http-request-processor

Usage

<?php

use DKX\MonologPsrHttpRequestProcessor\HttpRequestProcessor;
use DKX\MonologPsrHttpRequestProcessor\HttpRequestProviderInterface;
use Monolog\Logger;
use Psr\Http\Message\ServerRequestInterface;

$requestProvider = new class implements HttpRequestProviderInterface
{
    public function getRequest() : ?ServerRequestInterface
    {
        return get_current_http_request_somehow();
    }
};

$logger = new Logger('default');
$logger->pushProcessor(new HttpRequestProcessor($requestProvider));