PHPackages                             liborm85/loggable-http-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. liborm85/loggable-http-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

liborm85/loggable-http-client
=============================

Extended logging for the Symfony HTTP Client.

2.2.1(7mo ago)99.6k↓42.4%MITPHPPHP &gt;=8.1CI passing

Since May 12Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/liborm85/loggable-http-client)[ Packagist](https://packagist.org/packages/liborm85/loggable-http-client)[ RSS](/packages/liborm85-loggable-http-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (12)Used By (0)

Loggable HTTP Client [![Packagist](https://camo.githubusercontent.com/2f8b51cbfe1c9a38635a97b52e7ad77bc620f90bde2966ea2f05e24c373b4569/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c69626f726d38352f6c6f676761626c652d687474702d636c69656e742e737667)](https://packagist.org/packages/liborm85/loggable-http-client)
===============================================================================================================================================================================================================================================================================================================================================

[](#loggable-http-client-)

Extended logging for the Symfony HTTP Client allowing especially to log the content of the request and response.

Adds events to [PSR-3](https://www.php-fig.org/psr/psr-3/) logger interface:

- `'Response content:'` (level: `info`) - response body content received; in context is available (details in [Usage](#usage)):
    - `request` (`\Liborm85\LoggableHttpClient\Context\RequestContextInterface`)
    - `response` (`\Liborm85\LoggableHttpClient\Context\ResponseContextInterface`)
    - `info` (`\Liborm85\LoggableHttpClient\Context\InfoContextInterface`)
- `'Response content (canceled):'` (level: `info`) - same as above, only for canceled request (not all data may be available)

Adds additional information to `getInfo()` method:

- `request_json` (`mixed`) - `json` option from request `$options` (if is provided)
- `request_body` (`\Liborm85\LoggableHttpClient\Body\BodyInterface`) - `body` option from request `$options` transformed to object (if is provided)
- `response_time` (`float`) - the time when the response was received

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

[](#installation)

You can install it with:

```
composer require liborm85/loggable-http-client

```

Usage
-----

[](#usage)

```
