PHP code example of hryha / laravel-request-logger

1. Go to this page and download the library: Download hryha/laravel-request-logger 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/ */

    

hryha / laravel-request-logger example snippets


php artisan migrate

// In bootstrap/app.php for global middleware
return Application::configure(basePath: dirname(__DIR__))
    ->withMiddleware(function (Middleware $middleware): void {
        $middleware->prepend([
            \Hryha\RequestLogger\Http\Middleware\RequestLogger::class,
        ])
    })

// Or in your routes file for specific routes
Route::get('/user', [UserController::class, 'index'])->middleware(\Hryha\RequestLogger\Http\Middleware\RequestLogger::class);

$schedule->command('request-logs:clear')->daily();

resolve(RequestLogger::class)->addCustomField('user_id', Auth::id());
bash
php artisan vendor:publish --provider="Hryha\RequestLogger\RequestLoggerServiceProvider" 
 php
'middleware' => [
    \Hryha\SimpleBasicAuth\SimpleBasicAuth::class,
],