nickshek / laravel-request by nickshek1

A simple package to log all the requests in a database for Laravel 5
Package Data
Maintainer Username: nickshek1
Maintainer Contact: (Nick Shek)
Package Create Date: 2016-06-25
Package Last Update: 2016-07-16
Language: PHP
License: MIT
Last Refreshed: 2024-07-19 03:02:59
Package Statistics
Total Downloads: 136
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0


Latest Version on Packagist Software License Build Status Quality Score

A simple package to log all the requests in a database for Laravel 5.

Inspired by django-request

Note: This package is still very alpha!


You can install the package via composer:

composer require nickshek/laravel-request

Install service provider

// config/app.php
'providers' => [

publish migrations and config file

php artisan vendor:publish --provider="LaravelRequest\LaravelRequestServiceProvider"

Afterwards you can edit the file config/laravel-request.php to suit your needs.

Run migration to create required tables

php artisan migrate

By default, the middleware \LaravelRequest\Middleware\LogAfterRequest::class enables logging on all pages. You'll probably want to inherit your own class containing you application's logging rule handler.

namespace App\Http\Middleware;
// app/Http/Middleware/LogAfterRequestExceptAdmin.php
use LaravelRequest\Middleware\LogAfterRequest;

class LogAfterRequestExceptAdmin extends LogAfterRequest
  * @return bool
  protected function shouldLogRequest($request, $response)
    return $request->segment(1) !== 'admin';

Next, simply register the newly created class in your middleware stack.

// app/Http/Kernel.php

class Kernel extends HttpKernel
    protected $middleware = [
        // ...

    // ...

That's it!


The MIT License (MIT). Please see License File for more information.