1. Go to this page and download the library: Download knovator/httplogger library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
knovator / httplogger example snippets
return [
/*
* Filter out body fields which will never be logged.
*/
'except' => [
'password',
'password_confirmation',
],
/* Default log channel.*/
'log_channel' => 'custom_log',
/* logged user columns */
'action_by_columns' => [
'id',
'first_name',
'last_name',
'email',
'phone'
],
];
// Example implementation from `\knovator\logger\src\LogNonGetRequests`
public function shouldLogRequest(Request $request): bool
{
return in_array(strtolower($request->method()), ['post', 'put', 'patch', 'delete']);
}