malvik-lab / laravel-http-logger
Log every request and response of Laravel PHP Framework.
1.0.2
2024-06-04 15:44 UTC
README
Log every request and response of Laravel PHP Framework.
The package saves all the data of the requests and responses in the "request_log" table, but if you want you can use a custom adapter.
Installation
$ composer require malvik-lab/laravel-http-logger
Publish config file
$ php artisan vendor:publish --tag=malviklab-laravel-http-logger-config
Publish migration file
$ php artisan vendor:publish --tag=malviklab-laravel-http-logger-migrations
Run migration
$ php artisan migrate
(Recommended) Use on Global Middleware
// app/Http/Kernel.php protected $middleware = [ \MalvikLab\LaravelHttpLogger\Http\Middleware\LaravelHttpLoggerMiddleware::class, // ... ];
(Alternative) Use on your routes
Route::middleware(['malviklab-laravel-http-logger'])->group(function () { // your routes here });
Configuration
In the configuration file you can set any values present in the requests and responses to be hidden (eg password or access token), the word with which to hide and the adapter to be used for saving.
<?php // config/malviklab-laravel-http-logger.php return [ 'storageAdapter' => MalvikLab\LaravelHttpLogger\Http\Middleware\Adapters\DbAdapter::class, 'hiddenText' => '[ *** HIDDEN *** ]', 'keysToHide' => [ 'Authorization', 'password', 'token', ], ];