PHP code example of rulweb / laravel-profiler

1. Go to this page and download the library: Download rulweb/laravel-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/ */

    

rulweb / laravel-profiler example snippets


// app/Providers/AppServiceProvider.php

public function register()
{
    if (! $this->app->environment('production')) {
        $this->app->register(\JKocik\Laravel\Profiler\ServiceProvider::class);
    }
}

profiler_start('my time metric name');

// my code to track execution time

profiler_finish('my time metric name');

public function testBasicTest()
{
    $response = $this->get('/');

    $response->assertStatus(200);
}

public function testBasicTest()
{
    $this->assertTrue(true);
}

public function testBasicTest()
{
    $this->assertTrue(true);
    
    $this->app->terminate();
}

public function testBasicTest()
{
    factory(User::class)->create();
    
    profiler_reset();
    
    // act and assert
}
shell
php artisan vendor:publish --provider="JKocik\Laravel\Profiler\ServiceProvider"
shell
php artisan profiler:server
shell
php artisan profiler:client
shell
php artisan profiler:client -m
shell
php artisan profiler:status
shell
php artisan profiler:client -m