PHP code example of ctohm / laravel-request-profiler
1. Go to this page and download the library: Download ctohm/laravel-request-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/ */
ctohm / laravel-request-profiler example snippets
public function handle(Request $request, Closure $next)
{
// jumpstart the profiler at the beggining of the middleware
app('timings')->enabledIf(config('laravel-request-profiler.collect_timings'));
$request->headers->set('Request-Id', (string) str()->uuid());
app('timings')->pushTiming();
// here goes the original content for this middleware
$request::setTrustedProxies([], $this->getTrustedHeaderNames()); // Reset trusted proxies between requests
$this->setTrustedProxyIpAddresses($request);
// tap into the final output to wrap up the timings process
return tap($next($request), function () use ($request) {
app('timings')->pushTiming();
app('timings')->process_timings($request);
});
}
sh
php artisan vendor:publish --provider="CTOhm\LaravelRequestProfiler\Providers\TimingsServiceProvider" --tag=config