Download the PHP package mxnwire/laravel-logbarrel without Composer
On this page you can find all versions of the php package mxnwire/laravel-logbarrel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mxnwire/laravel-logbarrel
More information about mxnwire/laravel-logbarrel
Files in mxnwire/laravel-logbarrel
Package laravel-logbarrel
Short Description Log every incoming HTTP request (and optionally its response) to a dedicated channel, with redaction and fine-grained options
License MIT
Informations about the package laravel-logbarrel
Laravel LogBarrel
Log every incoming HTTP request — and optionally its response — to a dedicated channel, with sensitive-field redaction and fine-grained capture options. Drop it in and get a clean, queryable record of the traffic hitting your app.
Each request is written as a single log entry whose context holds the captured request and response data, for example:
Installation
The service provider is auto-discovered. By default the middleware is appended to the global HTTP stack, so every web/api request is logged with no further setup.
By default entries are written to a requests channel. Define it in
config/logging.php (or set LOGBARREL_CHANNEL=stack/null to use your default):
Configuration
Publish the config to customise behaviour:
Key options in config/logbarrel.php:
enabled— master switch; when false the middleware passes requests through untouched (LOGBARREL_ENABLED).register_global_middleware— when false, register manually with thelogbarrelalias instead of the global stack.channel/level/message— where, at what level and with what message each entry is logged.channel: nulluses the default channel.middleware_groups— only log requests whose matched route is in one of these groups (defaultweb,api). Empty array logs everything, including unrouted requests.except_paths— glob patterns (Str::is) whose paths are never logged (e.g.telescope*,_debugbar*).request— toggle capture ofmethod,url,route,query,body,headers,ip,user_agent,user.response— toggle capture ofstatus,duration, and (for JSON responses)content.except_body/except_headers— keys/headers whose values are replaced withredacted(default[REDACTED]); body keys are matched recursively.max_content_length— truncate captured bodies/response content beyond this many characters (nulldisables).user_fields— fields captured for the authenticated user; each is a model attribute name or a callable receiving the user.
Per-request control
The LogBarrel facade lets you tailor — or switch off — logging for the current
request from anywhere in the request lifecycle (a controller, form request,
action, event listener…). Because the entry is written after the response is
produced, anything you set is picked up when it matters. State is reset at the
start of every request, so it never leaks to the next one.
All methods are chainable and resolve the shared singleton, so
LogBarrel::context([...])->redact('ssn')->channel('audit') works as expected.
Prefer a helper over the facade? logbarrel() returns the same singleton:
Manual middleware registration
Set register_global_middleware to false, then apply the alias where needed:
Testing
License
MIT.
All versions of laravel-logbarrel with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0