PHP code example of it-al-perugia / phalcon-debugbar
1. Go to this page and download the library: Download it-al-perugia/phalcon-debugbar 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/ */
it-al-perugia / phalcon-debugbar example snippets
$application = new Phalcon\Mvc\Application( $di ); // Important: mustn't ignore $di param . The Same Micro APP: new Phalcon\Mvc\Micro($di);
$di['app'] = $application; // Important
(new Snowair\Debugbar\ServiceProvider())->start();
// after start the debugbar, you can do noting but handle your app right now.
echo $application->handle()->getContent();
(new Snowair\Debugbar\ServiceProvider('your-debugbar-config-file-path'))->start();
\PhalconDebug::startMeasure('start-1','how long'); // startMeasure($internal_sign_use_to_stop_measure, $label)
\PhalconDebug::addMeasurePoint('start'); // measure the spent time from latest measurepoint to now.
\PhalconDebug::addMessage('this is a message', 'label'); // add a message using a custom label.
\PhalconDebug::info($var1,$var2, $var3, ...); // add many messages once a time. See PSR-3 for other methods name.(debug,notice,warning,error,...)
\PhalconDebug::addMessageIfTrue('1 == "1"', 1=='1','custom_label'); // add message only when the second parameter is true
\PhalconDebug::addMessageIfTrue('will not show', 1=='0');
\PhalconDebug::addMessageIfFalse('1 != "0" ', 1=='0'); // add message only when the second parameter is false
\PhalconDebug::addMessageIfNull('condition is null', Null ); // add message only when the second parameter is NULL
\PhalconDebug::addMessageIfEmpty('condition is emtpy', $condition ); // add message only when the second parameter is empty
\PhalconDebug::addMessageIfNotEmpty('condition is not emtpy', $condition=[1] ); // add message only when the second parameter is not empty
\PhalconDebug::addException(new \Exception('oh , error'));
\PhalconDebug::addMeasurePoint('stop');
\PhalconDebug::stopMeasure('start-1'); // stopMeasure($internal_sign_use_to_stop_measure)
// service.php
$di->set('read-db-test',function(...)); // db service
$di->set('redis',function(...)); // cache service
if ( $di->has('debugbar') ) {
$debugbar = $di['debugbar'];
$debugbar->attachDb('read-db-test');
$debugbar->attachCache('redis');
}
php composer.phar
php composer.phar update snowair/phalcon-debugbar
(new \Snowair\Debugbar\Whoops\WhoopsServiceProvider($di));