Download the PHP package quetzal-studio/request-logger without Composer
On this page you can find all versions of the php package quetzal-studio/request-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download quetzal-studio/request-logger
More information about quetzal-studio/request-logger
Files in quetzal-studio/request-logger
Package request-logger
Short Description Request logger for laravel
License MIT
Informations about the package request-logger
Request Logger
Request logger for Laravel. Logs incoming requests (and outgoing Guzzle/HTTP client requests) with their responses to a dedicated log channel, with configurable masking for sensitive fields.
Requirements
| Version | |
|---|---|
| PHP | 7.4 – 8.5 |
| Laravel | 6.x – 13.x |
Install package
Publish config file
Using middleware
Laravel 6 – 9
Laravel 10
Laravel 11 – 13
Then attach it to routes:
Logging runs in the middleware's terminate() method, after the response has been sent to the client, so it does not add to response time.
Log channel
By default logs are written to the request channel. If that channel is not defined in config/logging.php, a daily driver writing to storage/logs/request/request.log (14 days retention) is created automatically. Change the default channel via request_logger.log.channel or per route with the middleware parameter.
Message-only logging
By default every entry includes the full request/response context. To log only the message line ({http_method} {url} {http_status}) without the request and response payloads, set the config globally:
Or per call with withoutContext():
Masking
Keys listed in the masking config are replaced before logging. A plain key is fully masked with ********:
Keys support dot notation for nested values (e.g. user.password).
Partial masking
For PII fields you need to trace in the logs (which email/phone/account a request was about), use the mask option to keep part of the value visible:
show_last/show_firstare capped at 4 characters, even if you configure more.- Values too short to mask meaningfully (fewer than 4 hidden characters left) fall back to the full
********mask. - Keep secrets (
password,client_secret,authorization, tokens) fully masked — partial masking is meant for identifiers, not credentials.
Mask only on specific URLs
The key is masked only when the request URL matches one of the patterns.
Log a custom message
The logger can also be used directly, without request/response context:
You can attach only a request, only a response, or both — whatever is set is included in the log context (with masking applied):