Download the PHP package hryha/laravel-request-logger without Composer
On this page you can find all versions of the php package hryha/laravel-request-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hryha/laravel-request-logger
More information about hryha/laravel-request-logger
Files in hryha/laravel-request-logger
Package laravel-request-logger
Short Description A Laravel package to log requests and responses
License MIT
Homepage https://github.com/vaniok010/laravel-request-logger
Informations about the package laravel-request-logger
Request Logger for Laravel
Overview
This package provides middleware that logs incoming HTTP requests and responses in Laravel applications.
You can view your logs through a dedicated panel at https://your.domain/request-logs
.
Features
- HTTP request and response logging
- Web-based log viewer interface
- Duplicated requests
- Configurable data retention period
- Sensitive data masking
- Support for custom logging fields
Requirements
- PHP 8.2 or higher
- Laravel 11 or higher
- MySQL 5.7 or higher
Installation
Install the package via Composer::
Run the database migrations:
Optionally, publish the package's configuration file:
View the complete configuration options: here.
The package provides middleware that can be registered either globally or on specific routes.
Data Pruning
To prevent the request_logs
table from growing too large, schedule the request-logs:clear
command to run daily:
The request-logs:clear
command removes logs older than the number of days specified in your log_keep_days
configuration.
To delete all logs, use the --all parameter:
Custom Fields
The Request Logger supports additional custom fields for enhanced logging capabilities.
Use the RequestLogger::addCustomField(key, value)
method to include additional data in your logs.
Additional data can be added from anywhere in the application using this code:
also, to filter logs by this field, you can add this field to the settings
Ignoring Responses by Status Code
Configure status codes to ignore by setting REQUEST_LOGGER_IGNORE_RESPONSE_STATUSES
in your .env
file.
The setting accepts both status ranges and specific status codes:
This configuration will ignore logs for responses with status codes between 100-299
, as well as 301
and 302
responses.
Panel authorization
Be sure to protect this panel from unauthorized access. We recommend using Basic Auth middleware or something similar.
To do this, add an auth middleware
in request-logger.php
Testing
Run the test:
All versions of laravel-request-logger with dependencies
illuminate/support Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
ext-json Version *