PHP code example of lsrur / inspector

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

    

lsrur / inspector example snippets


Lsrur\Inspector\InspectorServiceProvider::class,

'Inspector' => Lsrur\Inspector\Facade\Inspector::class,

public function register()
{
  // ...
  if ($this->app->environment() == 'development') {
      $this->app->register(\Lsrur\Inspector\InspectorServiceProvider::class);
  }
  // ...
}
    
public function render($request, Exception $exception)
{
    \Inspector::renderException($exception);	// <= THIS LINE
    return parent::render($request, $exception);
}

//Using Facade
\Inspector::log(...);
\Inspector::info(...);

//Using the "inspector" helper function
inspector()->info(...);
inspector()->warning($myVar);

// "li" is an alias of "inspector"
li()->error(...);
li()->group('myGroup');

// "inspect" function makes an "Inspector::log($v)" for each passed argument
inspect($var1, $var2, $var3, ...);

// Dump and die using Laravel Inspector magic
idd();
idd($var1, $var2);

// Inside Blade
@li(cmd,param1,param2,...)

// samples
@li('log', 'My comment', $myVar)
@li(log, 'My comment', $myVar) //also works without command quotes
@li(group,"myGroup")
@li(endGroup)

li()->turnOff();

li()->log("MyData", $myData);
li()->info($myData);
li()->table("clients", $myClientsCollection);

inspect($var1, $var2, $var3,...);

li()->group('MyGroup');
	li()->info($data);
	li()->group('MySubGroup');
		li()->error('oops', $errorCode);
	li()->groupEnd();
	li()->success('perfect!');
li()->groupEnd();

li()->time("MyTimer");
// ...
li()->timeEnd("MyTimer");

li()->timeStamp('Elapsed time from LARAVEL_START here');

\Inspector::dd();
li()->dd();

// or simply
idd();

// adding last minute data
idd($var1, $var2,...)

try {
	...
} catch (Exception $e) {
	li()->addException($e);
}

public function render($request, Exception $exception)
{
    if (\App::environment() == 'development')
    {
        \Lsrur\Inspector\Facade\Inspector::renderException($exception);
    }
    return parent::render($request, $exception);
}