PHP code example of zeeshantariq / laravel-api-profiler
1. Go to this page and download the library: Download zeeshantariq/laravel-api-profiler 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/ */
zeeshantariq / laravel-api-profiler example snippets
use ZeeshanTariq\LaravelApiProfiler\Middleware\ApiProfilerMiddleware;
Route::middleware(['api', ApiProfilerMiddleware::class])->group(function () {
// Your API routes
});
Route::middleware(['api', 'api-profiler'])->group(function () {
// Your API routes
});
return [
// Enable/disable the profiler
'enabled' => env('API_PROFILER_ENABLED', true),
// Slow request threshold in milliseconds
'slow_request_threshold_ms' => 500,
// High memory threshold in bytes (default: 128MB)
'high_memory_bytes' => 128 * 1024 * 1024,
// N+1 query detection threshold
'n_plus_one_threshold' => 5,
// Number of samples for baseline calculation
'baseline_sample_size' => 50,
// Middleware for dashboard routes
'middleware' => ['web', 'auth'],
];