Skip to content

Instantly share code, notes, and snippets.

@joseadrian
Last active August 29, 2015 14:08
Show Gist options
  • Save joseadrian/0ea29bde49814281108d to your computer and use it in GitHub Desktop.
Save joseadrian/0ea29bde49814281108d to your computer and use it in GitHub Desktop.
PHP CI Debugger
<?php
if(isset($_GET['sleep']) and !empty($_GET['sleep']))
{
sleep($_GET['sleep']);
}
/* Muestra la memoría usada en Consola */
register_shutdown_function('memory');
function load_debug()
{
$handler = PhpConsole\Handler::getInstance();
$handler->start();
PhpConsole\Helper::register();
ref::config('expLvl', 5);
}
function dd()
{
die(array_walk(func_get_args(), 'r'));
}
function dj($data)
{
header('Content-Type: application/json; charset=UTF8');
die(json_encode($data));
}
function backtrace()
{
PC::trace(debug_backtrace());
}
function chrome($args)
{
PC::debug($args);
}
function trace($data)
{
PhpConsole\Connector::getInstance()->getDebugDispatcher()->detectTraceAndSource = true;
PhpConsole\Connector::getInstance()->getDebugDispatcher()->dispatchDebug($data, 'debug');
}
function profile()
{
$ci = get_instance();
PC::profile(array(
'query' => $ci->db->queries,
'data' => $ci->get(),
'memory' => memory_get_usage() / 1024
));
}
function last_query()
{
$ci =& get_instance();
PC::last_query(array_pop($ci->db->queries));
}
function memory()
{
PC::memory(memory_get_usage() / 1024);
}
{
"require": {
},
"require-dev": {
"digitalnature/php-ref": "dev-master",
"php-console/php-console": "3.*"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment