bilfeldt/laravel-request-logger
Log incoming HTTP requests in Laravel with a simple middleware. Capture method, URL, headers, payload, response status and timing, then store to database or logs for debugging, auditing and performance insights. Configurable, lightweight, easy to add to routes or globally.
bilfeldt/laravel-correlation-id) enhances observability for distributed systems, aligning with modern microservices and observability trends.model:prune (or custom commands) ensures scalability for high-traffic applications by preventing log bloat.composer require + migrations, with optional config publishing. Low friction for adoption.Route::middleware('requestlog')), avoiding invasive changes to business logic.REQUEST_LOGGER_DB_CONNECTION), reducing main DB load and enabling archival strategies.Authorization) prevents sensitive data leaks while logging payloads.bilfeldt/laravel-correlation-id (v3.0+), adding a new dependency. Mitigate by evaluating if this is acceptable for your stack.correlation_id, request_id) in request_logs table may require downtime for large deployments. Test in staging first.aggregate() method and log_context config require migration to alternatives (e.g., laravel-route-statistics).api_token but may need customization for other PII (e.g., password, credit_card). Use config('request-logger.headers') to filter.response->setContent('***')).bilfeldt/laravel-route-statistics.requestlog:prune --days=30).RequestLog model to redact fields.request_logs (e.g., user_id, path, status_code).correlation_id/request_id.REQUEST_LOGGER_DB_CONNECTION.laravel-correlation-id for distributed tracing (e.g., Jaeger, Datadog).composer test in your pipeline.php artisan migrate succeeds in CI./api/payments) before global enablement.bilfeldt/laravel-correlation-id (composer require).correlation_id/request_id columns.aggregate() calls with laravel-route-statistics.php artisan vendor:publish --tag=request-logger-config.'headers' => ['authorization', 'proxy-authorization'], // Case-insensitive filtering
'exclude_parameters' => ['password', 'credit_card'],
'log_statuses' => ['4**', '5**'], // Log only errors
Route::middleware('requestlog')->group(...)).php artisan schedule:run (if using Laravel Forge/Envoyer).auth, throttle) and third-party packages (e.g., spatie/laravel-honeypot).RequestLog in unit tests:
$this->partialMock(RequestLog::class, fn($mock) => $mock->shouldReceive('create()->once()));
HttpTests trait for integration tests:
public function test_logs_request()
{
$response = $this->get('/api/endpoint');
$this->assertDatabaseHas('request_logs', ['path' => '/api/endpoint']);
}
ab -n 10000).500 responses) post-deployment.request_logs (e.g., WHERE status_code = 500).bilfeldt/laravel-correlation-id (v3.x+) adds maintenance overhead. Monitor for updates.prune command or a cron job to manage storage:
php artisan requestlog:prune --days=30
request_logs table by date.EXPLAIN ANALYZE).How can I help you explore Laravel packages today?