Skip to content

Instantly share code, notes, and snippets.

@ivanotOrozco
Created July 2, 2019 22:09
Show Gist options
  • Save ivanotOrozco/d1c11a16a10223a9f50a4e2799e7ff8a to your computer and use it in GitHub Desktop.
Save ivanotOrozco/d1c11a16a10223a9f50a4e2799e7ff8a to your computer and use it in GitHub Desktop.
Fast debuger on Codeigniter like dd() from Laravel
<?php
// locate on helpers and load from config/autoload.php $autoload['helper']
// on any place of project call dd([$my, $vars, $to, $see]); and reload de browser
if(!function_exists('dd'))
{
function dd($params)
{
echo '<div id="dbg-screen" style="background-color: #000; color: #00FF10 !important; width: 100%;height: 700px;position: absolute;padding: 10px;top:0;left:0;z-index: 10000; overflow:scroll;">';
echo '<span id="close-btn-dbg" style="position:relative; top:0px; left:95%;">-</span>';
echo '<pre style=" color: #00FF10 !important">';
// echo '['.count($params).'] ';
echo print_r($params);
echo "</pre>";
echo '</div>';
$html = "<script type=\"text/javascript\">
document.querySelector('#close-btn-dbg').addEventListener('click',() => {
document.querySelector('#dbg-screen').style.height = '50px';
})
</script>";
echo $html;
die();
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment