PHP code example of sl-projects / laravel-request-logger
1. Go to this page and download the library: Download sl-projects/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/ */
sl-projects / laravel-request-logger example snippets
// In app/Http/Kernel.php (for "old" Laravel 11 and older)
protected $middleware = [
// ...
\SlProjects\LaravelRequestLogger\app\Http\Middleware\SaveRequestMiddleware::class,
];
// In bootstrap/app.php (for "new" Laravel 11 and newer)
return Application::configure(basePath: dirname(__DIR__))
->withMiddleware(function (Middleware $middleware) {
// ...
$middleware->append(\SlProjects\LaravelRequestLogger\app\Http\Middleware\SaveRequestMiddleware::class);
});
// In app/Console/Kernel.php (for "old" Laravel 11 and older)
protected function schedule(Schedule $schedule)
{
$schedule->command('save:requests')->everyMinute();
}
// In routes/console.php (for "new" Laravel 11 and newer)
Schedule::command('save:requests')->everyMinute();