PHP code example of webxid / debug-helpers

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

    

webxid / debug-helpers example snippets


use function WebXID\DebugHelpers\_dump;
use function WebXID\DebugHelpers\__dump;

_dump($data); // To print data dump into a browser
__dump($data); // To print data dump into a command line

use function WebXID\DebugHelpers\_backtrace;

_backtrace(); // print a Back trace from a script start file to the currecn place

use function WebXID\DebugHelpers\_trackTime;

_trackTime('track_magic_time'); // start track of `track_magic_time`

// Do a magic

echo _trackTime('track_magic_time'); // print a `track_magic_time` execution time

echo _trackTime(true); // print the all registered time track keys data

use function WebXID\DebugHelpers\_cachedLog;

$var = 1;
_cachedLog('$var', $var);

$var = 2;
_cachedLog('$var', $var);

$var = 3;
_cachedLog('$var', $var);

// print cached data of the key `$var` 
print_r(_cachedLog('$var'));
/**
 * will prints the array
 * [
 *      '$var' => [
 *          1,
 *          2,
 *          3,
 *      ],
 * ]
 */
 
 print_r(_cachedLog()); // prints all cached data


use WebXID\DebugHelpers\Environment;
use function WebXID\DebugHelpers\_log;
use function WebXID\DebugHelpers\_logWithClean; 
use function WebXID\DebugHelpers\_logAndDie;
use function WebXID\DebugHelpers\_logWithCleanAndDie;

Environment::setRootDir(__DIR__);

_log($data); // Adds Dump of the $data var to the end of log file and continue a script procssing
_logWithClean($data); // Cleaned up the log file, Dumps the $data var and continue a script procssing
_logAndDie($data); // Adds Dump of the $data var to the end of log file and break a script processing
_logWithCleanAndDie($data); // Cleaned up the log file, Adds Dump of the $data var to the end of log file and break a script processing