PHP code example of farzai / laravel-http-recorder

1. Go to this page and download the library: Download farzai/laravel-http-recorder 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/ */

    

farzai / laravel-http-recorder example snippets


return [
    /*
     * Enable or disable the http recorder.
     */
    'enabled' => env('HTTP_RECORDER_ENABLED', true),

    /*
     * The driver used to store the http logs.
     * It should be a class that implements the `Farzai\HttpRecorder\Contracts\EntryRepositoryInterface`.
     *
     * Supported drivers: "database"
     */
    'driver' => env('HTTP_RECORDER_DRIVER', 'database'),

    /**
     * Process the request in the background.
     * (leave it to empty to use default queue)
     */
    'queue' => env('HTTP_RECORDER_QUEUE'),
    // 'queue' => [
    //     'connection' => env('HTTP_RECORDER_QUEUE_CONNECTION'),
    //     'queue' => env('HTTP_RECORDER_QUEUE_NAME'),
    // ]

    /*
     * Exclude routes from being logged.
     */
    'except' => [
        'urls' => [
            'telescope*',
            'horizon*',
            'nova*',
        ],

        'methods' => [
            'HEAD',
        ],
    ],

    /**
     * Drivers
     */
    'drivers' => [
        'database' => [
            'connection' => env('HTTP_RECORDER_CONNECTION'),
            'table' => env('HTTP_RECORDER_DB_TABLE', 'http_log_requests'),
        ],
    ],

    /**
     * Sensitive request headers and response.
     * 
     * These fields will be replaced with asterisks (*) in the request headers.
     */
    'sensitive' => [
        'headers' => [
            'authorization',
            'x-csrf-token',
            'x-xsrf-token',
            'set-cookie',
        ],
        'body' => [
            'password',
            'password_confirmation',
            'token',
            'access_token',
        ],
    ],

    /**
     * The maximum length of the request body and response body.
     *
     * If the length of the request body or response body exceeds the maximum length,
     * it will be truncated to the maximum length.
     */
    'size_limit' => 64
];
bash
php artisan vendor:publish --tag="http-recorder-migrations"
bash
php artisan migrate
bash
php artisan vendor:publish --tag="http-recorder-config"