bilfeldt / laravel-route-statistics

Log requests and group together for aggregated statistics of route usage
MIT License
221 stars 23 forks source link

README: Enable global logging class RouteStatisticsMiddleware does not exist #7

Closed RicardoRamirezR closed 2 years ago

RicardoRamirezR commented 2 years ago

Hi @bilfeldt be aware that RouteStatisticsMiddleware does not exists while RouteStatistics does exists

bilfeldt commented 2 years ago

Hi @bilfeldt be aware that RouteStatisticsMiddleware does not exists while RouteStatistics does exists

@RicardoRamirezR I am not sure what you mean exactly? The RouteStatisticsMiddleware does exist and can be located here: https://github.com/bilfeldt/laravel-route-statistics/blob/main/src/Http/Middleware/RouteStatisticsMiddleware.php

Note that this middleware has an alias routestatistics

bilfeldt commented 2 years ago

@RicardoRamirezR Does #8 solve the issue you were mentioning (opposite of original description as the docs mentioned the RouteStatistics middleware while the actual class name was RouteStatisticsMiddleware)?

RicardoRamirezR commented 2 years ago

Seems odd @bilfeldt I just installed you package for Laravel 7, and looking at bilfeldt/laravel-route-statistics/src/Http/Middleware/RouteStatistics.php

<?php

namespace Bilfeldt\LaravelRouteStatistics\Http\Middleware;

use Closure;

class RouteStatistics
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $request->routeStatistics();

        return $next($request);
    }
}
bilfeldt commented 2 years ago

@RicardoRamirezR This is because you have version 0.3.x installed. Version 0.4 renamed this class and increased the required Laravel version to ^8.50: https://github.com/bilfeldt/laravel-route-statistics/releases/tag/v0.4.0

I have updated the CHANGELOG.md so that this is clear and #8 should clarify any naming issues in the README.md. Thanks for pointing this out.