1. Go to this page and download the library: Download slogger/laravel 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/ */
slogger / laravel example snippets
\SLoggerLaravel\Middleware\HttpMiddleware::class
'watchers' => [
[
'class' => \SLoggerLaravel\Watchers\Parents\RequestWatcher::class,
'enabled' => env('SLOGGER_LOG_REQUESTS_ENABLED', false),
'config' => [
// log only matched paths (optional)
'only_paths' => [
// 'api/*',
],
// skip matched paths
'excepted_paths' => [
// 'health',
],
'input' => [
// apply input formatting only for these paths
'only_paths' => [
// 'api/*',
],
// hide all request params for these paths
'hidden_paths' => [
// 'auth/*',
],
// header masking by url_pattern
'headers_masking' => [
'*' => ['authorization', 'cookie', 'x-xsrf-token'],
],
// param masking by url_pattern
'parameters_masking' => [
'*' => ['*token*', '*password*'],
],
],
'output' => [
// apply response formatting only for these paths
'only_paths' => [
// 'api/*',
],
// hide all response data for these paths
'hidden_paths' => [
// 'auth/*',
],
// response header masking by url_pattern
'headers_masking' => [
'*' => ['set-cookie'],
],
// response field masking by url_pattern
'fields_masking' => [
'*' => ['*token*', '*password*'],
],
// limit json response size (bytes)
'max_content_length' => 1048576,
],
],
],
],
new \GuzzleHttp\Client([
'base_uri' => 'https://url.com',
'handler' => app(\SLoggerLaravel\Guzzle\GuzzleHandlerFactory::class)->prepareHandler(
(new \SLoggerLaravel\RequestPreparer\RequestDataFormatters())
->add(
new \SLoggerLaravel\RequestPreparer\RequestDataFormatter(
urlPatterns: ['*'],
requestHeaders: ['authorization']
)
)
->add(
new \SLoggerLaravel\RequestPreparer\RequestDataFormatter(
urlPatterns: ['/api/auth/*', '*sensitive/some/*'],
hideAllResponseData: true
)
)
),
])