Download the PHP package bilfeldt/laravel-http-client-logger without Composer
On this page you can find all versions of the php package bilfeldt/laravel-http-client-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bilfeldt/laravel-http-client-logger
More information about bilfeldt/laravel-http-client-logger
Files in bilfeldt/laravel-http-client-logger
Package laravel-http-client-logger
Short Description A logger for the Laravel HTTP Client
License MIT
Homepage https://github.com/bilfeldt/laravel-http-client-logger
Informations about the package laravel-http-client-logger
:open_file_folder: A logger for the Laravel HTTP Client
An easy yet very flexible logger for the Laravel HTTP Client.
Version | Laravel | PHP |
---|---|---|
1.* | 8. | 9. | 7.4. | 8.0. |
2.* | 9. | 10. | 11.* | 8.1. | 8.2. | 8.3.* |
Installation
You can install the package via composer:
Laravel
This package makes use of Laravels package auto-discovery mechanism so there is no need to do any futher steps - skip directly to the the Laravel Docs for more details.
Lumen
NOTE: Lumen is not officially supported by this package. However, we are currently not aware of any incompatibilities.
If you use Lumen register the service provider in bootstrap/app.php
like so:
Config
Optionally in Laravel publish the config file with:
Usage
Using the logger will log both the request, the response and the response time of an external HTTP request made with the Laravel HTTP Client.
Basic logging
Conditional logging
This will log the request/response when the $condition
evaluates to true
.
Logging context
It is possible to supply context for the logger using:
Providing on-demand configuration
It is possible to provide on-demand configuration which will override the package configuration specified in config/laravel-http-client-logger.php
:
Specifying a logger
The default logger and filter are specified in the package configuration logger
and filter
respectively but can be changed at runtime using:
Note that the logger must implement HttpLoggerInterface
while the filter must implement HttpLoggingFilterInterface
.
Logging example
The default logger converts the request and response to a PSR-7 HTTP message which is then logged as strings.
Log entry example when using default logger:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- Anders Bilfeldt: Main package developer
- Henry Be: Cover image
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-http-client-logger with dependencies
ext-json Version *
guzzlehttp/guzzle Version ^7.2
illuminate/http Version ^9.0 || ^10.0 || ^11.0
illuminate/support Version ^9.0 || ^10.0 || ^11.0
spatie/laravel-package-tools Version ^1.1