PHP code example of fabacino / debug-functions

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

    

fabacino / debug-functions example snippets


dbg(123);
dbg('a string');
dbg([
    'token' => 'dp83kspo',
    'is_default' => true
]);

dbginit(['use_vardump' => true]);
dbg(123);
// or
dbg(123, Debug::USE_VARDUMP);
// which is the same as
dbg(123, 1);

dbginit(['use_htmlentities' => true]);
dbg('<b>important</b>');
// or
dbg('<b>important</b>', Debug::USE_HTMLENTITIES);
// which is the same as
dbg('<b>important</b>', 2);

// dbgr is the same as dbg, except that the output is returned instead of printed.
$dbg = dbgr(123);

// dbglog is the same as dbg, except that the output is logged instead of printed.
dbginit(['log_file' => '/path/to/logfile']);
dbglog($this->doSomething());

$logger = new YourLogger();
...
dbginit(['logger' => $logger]);
dbglog($this->doSomething());