prettus/laravel-request-logger
Laravel middleware that logs every HTTP request and response to the database. Configurable logging per route, sensitive data redaction, custom log profiles, and Eloquent model integration make it a simple way to audit and debug API traffic in Laravel apps.
Architecture fit. The package is a single-purpose HTTP middleware that sits in Laravel's request pipeline, serializing request (and optionally response) data into the framework's existing logging stack. It is a thin decorator over Monolog, not an observability system: no tracing, no correlation IDs, no sampling, no structured query layer, no aggregation. It fits applications that need a low-effort append-only audit or debugging trail on disk. It does not fit teams that need queryable, high-cardinality request telemetry — that is Laravel Telescope, OpenTelemetry, or a commercial APM, and adopting this package in that role would be a category error.
Integration feasibility. The public surface is small and conventional: composer require, register the middleware globally or on a route group, publish and tune the config. Configuration governs what is captured and what is excluded, which is the main lever for both cost and privacy. The footprint is shallow enough that a spike can answer the remaining questions in days rather than weeks.
Technical risk. The dominant risk is abandonment. The last tagged release is 2018-01-17, which predates Laravel 6 LTS; Composer version constraints, middleware signatures, and PHP 8 typing are the likely friction points, and none of it is being fixed upstream. Secondary risks are data-handling rather than functional: capture of Authorization headers, cookies, and request bodies creates a PII/secret exposure surface with no guaranteed redaction, and per-request body serialization adds synchronous I/O plus unbounded log growth. Treat "does it install and run" as an easy question and "should this data be in our logs" as the hard one.
Key questions.
Stack fit. Strong fit for a standard Laravel monolith on a 5.x/6.x-era codebase that wants request-level audit logs in files with minimal engineering. Weak fit for multi-service or container-heavy estates where logs need correlation across services, and for any environment with strict data-residency or PII controls that the package cannot satisfy out of the box.
Migration path. Three options, in order of preference for a modern stack: (1) vendor a trimmed in-house middleware — roughly 100 lines delegating to a dedicated requests log channel — which removes the dependency and lets us own redaction and schema; (2) fork the package, relax Composer constraints, update signatures for the target Laravel/PHP versions, and add redaction; (3) adopt it as-is only if the target is an older Laravel where it installs and runs cleanly. Options 1 and 2 are close in cost; option 1 wins on long-term clarity.
Compatibility. Verify against the real matrix before committing: PHP 8.x, Laravel 9/10/11, Monolog 2 vs 3, Symfony HttpFoundation 6/7, and the middleware registration style in use (Kernel array vs bootstrap append/prepend). Confirm behavior under Octane or any long-running worker, and confirm the middleware is wrapped defensively so a logging exception cannot 500 a request. Do this in CI, not in a review meeting.
Sequencing. (1) One-week spike: install against the newest target version, capture failures, size the fork. (2) Define the log schema and redaction rules — headers to drop, fields to hash, body capture policy — before any production traffic. (3) Provision a dedicated channel and disk with rotation and retention. (4) Roll out to staging and one low-risk production service with sampling on. (5) Measure volume and latency delta for two weeks. (6) Expand or abandon based on that data.
Maintenance. Upstream is effectively dormant, so maintenance becomes an internal line item: dependency bumps, PHP/Laravel upgrades, and security review of a component that touches every request. The surface is small enough that the annual cost is a few engineer-days, not a standing commitment — but it is not zero, and it must be named in the owning team's backlog or it will silently rot.
Support. Community-only, no vendor, no SLA, and an unanswered-issue risk on anything non-obvious. The mitigating factor is reversibility: the component is replaceable in an afternoon, so lock-in is negligible and the support gap is survivable if the fork is well documented.
Scaling. Each request pays serialization plus a synchronous write. At moderate volume this is noise; at high volume, body capture dominates and can push log storage and I/O into a real budget line. Mitigate with sampling, metadata-only capture by default, and an asynchronous or buffered channel where the stack allows. Capacity planning should treat log volume as a first-class metric, not an afterthought.
Failure modes. Logging exceptions surfacing as 500s if the middleware is not exception-safe; memory spikes on large or multipart payloads; credentials and PII landing in logs permanently; disk exhaustion degrading the host; silent data loss if a buffered handler drops entries; and hard boot failures when a version mismatch breaks container resolution. The first and last are the ones that page someone.
Ramp-up. Trivial for any Laravel developer — an hour to install and configure, half a day to understand the options. The real ramp-up is organizational: agreeing on redaction rules, retention, and which team owns the fork. Budget for the policy work, not the code.
How can I help you explore Laravel packages today?