Last active
August 29, 2015 14:08
-
-
Save joseadrian/0ea29bde49814281108d to your computer and use it in GitHub Desktop.
PHP CI Debugger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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