- What is bilfeldt/laravel-request-logger used for?
- It logs Laravel application request and response data with a unique ID so support and engineering can trace a customer issue back to a specific request. It is useful for customer-support forensics and durable, queryable per-request records. It is not a replacement for Laravel Telescope or an APM/Sentry-style error correlation tool.
- How do I install bilfeldt/laravel-request-logger in Laravel?
- Install it with composer require bilfeldt/laravel-request-logger, then publish the migrations and run php artisan migrate. You can optionally publish the config file to customize storage and filtering behavior. On Laravel 11 and newer, manually register the requestlog middleware alias in bootstrap/app.php because this step is easy to miss.
- Which Laravel and PHP versions does laravel-request-logger support?
- Version 3 supports Laravel 10, 11, 12, and 13 with PHP 8.1 through 8.5. Version 2 targets Laravel 10, while version 1 covers Laravel 8 and 9 with older PHP versions. Always check the package compatibility table before pinning a version in composer.json.
- How do I enable request logging only on specific routes?
- The recommended approach is to apply the requestlog middleware to the routes or route groups you want to log. You can also enable logging globally or conditionally through the package config file. On Laravel 11 and newer, register the requestlog alias in bootstrap/app.php before using it in routes.
- Does laravel-request-logger require a database?
- By default it writes request and response records to a database table through an Eloquent RequestLog model. It uses Laravel's manager and driver pattern, so you can swap in custom storage drivers without forking the package. No external services, agents, or queues are required by default.
- Is it safe to log Authorization headers and request bodies with this package?
- Treat sensitive-header and PII filtering as something you must verify in the exact version you install. The changelog records a defect where the default Authorization header filter never matched because Symfony lowercases header names, so Bearer tokens were silently written to the log table. It is reported as fixed, but the changelog and v3.9.0 release notes are inconsistent, so inspect the installed code rather than trusting release notes. Define a payload-key denylist and PII policy before enabling logging on production routes.
- What are the production risks of using laravel-request-logger?
- Every logged request performs a synchronous database insert on the request path, which couples application latency and availability to the logging database unless you configure it otherwise. Unbounded data growth is a documented operational hazard, so plan retention, pruning, and possibly a dedicated logging database connection. Test what happens to an inbound request if the log insert fails, because silent degradation versus request failure matters operationally. Also weigh the single-maintainer and low-adoption risk against your third-party dependency policy.
- How does the correlation ID work in laravel-request-logger v3?
- Version 3 has a hard dependency on bilfeldt/laravel-correlation-id from the same author. The correlation-ID and request-ID plumbing now lives in that sibling package, so you need to track, pin, and upgrade both packages in lockstep. The resulting unique ID is what lets support look up a logged request from a customer ticket.
- How can I test request logging in Laravel?
- Register the requestlog middleware on a test route or enable logging through config, then make a request and assert that a RequestLog record was created. Use Laravel's database assertions and a dedicated test database or transactions to keep tests isolated. If you use a custom driver, swap in a test double and assert the captured payload and filtering behavior directly.
- What alternatives exist to bilfeldt/laravel-request-logger?
- Laravel Telescope is usually the cheaper choice for developer debugging, while APM tools and Sentry are better for error correlation and performance monitoring. This package's niche is durable, queryable per-request records tied to a correlation ID that support can look up from a ticket. If you do not need that specific workflow, Telescope or your existing APM is likely sufficient. If you do adopt it, account for its single maintainer, roughly 128 stars, and very low third-party adoption.