PHP code example of nimblephp / debugbar
1. Go to this page and download the library: Download nimblephp/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/ */
nimblephp / debugbar example snippets
(new Debugbar())->init();
echo \Nimblephp\debugbar\Debugbar::renderHeader();
echo \Nimblephp\debugbar\Debugbar::render();
use Nimblephp\debugbar\Debugbar;
class Middleware extends \Nimblephp\framework\Middleware
{
public function afterBootstrap()
{
(new Debugbar())->init();
}
public function handleException(Throwable $exception)
{
\Nimblephp\debugbar\Debugbar::$debugBar['exceptions']->addThrowable($exception);
}
public function beforeController(string $controllerName, string $action, array $params)
{
\Nimblephp\debugbar\Debugbar::$debugBar['time']->startMeasure('load-controller-' . $controllerName . $action, 'Load ' . str_replace('\src\Controller\\', '', $controllerName) . ' controller');
}
public function afterController(string $controllerName, string $action, array $params)
{
\Nimblephp\debugbar\Debugbar::$debugBar['time']->stopMeasure('load-controller-' . $controllerName . $action);
if (!Debugbar::$debugBar->hasCollector('module_register')) {
Debugbar::$debugBar->addCollector(new \Nimblephp\debugbar\Collectors\ModuleCollector(\Nimblephp\framework\ModuleRegister::getAll()));
}
}
}