nin/phalcon-debugbar

Integrates PHP Debug Bar with Phalcon 5.

v1.0.0 2023-02-18 04:12 UTC

This package is auto-updated.

Last update: 2024-04-18 07:07:44 UTC


README

Packagist License Latest Stable Version Total Downloads

This is a package to integrate PHP Debug Bar with Phalcon 5.

Phalcon 5 debugbar

Note: Use the DebugBar only in development. It can slow the application down (because it has to gather data). So when experiencing slowness, try disabling some of the collectors.

Installation:

Require this package with composer. It is recommended to only require the package for development.

composer require nin/phalcon-debugbar --dev

Register a Provider in index.php

$container = new \Phalcon\Di\FactoryDefault();

$container->register(new \Nin\Debugbar\ServiceProvider());

Usage:

Add Message

use Nin\Debugbar\Phalcon\Helper\Debugbar;

Debugbar::info($object);
Debugbar::error('Error!');
Debugbar::warning(new \Phalcon\Config\Config(['title' => 'Warning']));

Add start/stop timing:

use Nin\Debugbar\Phalcon\Helper\Debugbar;

Debugbar::startMeasure('function', 'Function runtime');
Debugbar::stopMeasure('function');
Debugbar::measure('function', function() {
    // Do something…
});

Add Log Exception:

use Nin\Debugbar\Phalcon\Helper\Debugbar;

try {
    //  Do something
} catch (Exception $e) {
    Debugbar::addThrowable($e);
}