2017 © Pedro Peláez
 

library phpdebugbar

A wrapper for maximebf/debugbar to be simpler and configurable (e.g. disabled in production) on instantiation.

image

martynbiz/phpdebugbar

A wrapper for maximebf/debugbar to be simpler and configurable (e.g. disabled in production) on instantiation.

  • Thursday, June 11, 2015
  • by martynbiz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 65 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PHP Debug Bar (wrapper)

A wrapper for maximebf/debugbar to be simpler and configurable (e.g. disabled in production) on instantiation., (*1)

Installation

via Composer:, (*2)

"martynbiz/phpdebugbar": "dev-master"

Alternatively, clone and copy into your project:, (*3)

clone https://github.com/martynbiz/phpdebugbar.git

Usage

Firstly, a symlink needs to be made from your project's public directory to the assets directory of maximebf/debugbar/.../Resources. This gives the project access to the neccessary CSS and Js files for the debug bar., (*4)

ln -s ../vendor/maximebf/debugbar/src/DebugBar/Resources phpdebugbar

Note: This path may vary depending on your folder structure., (*5)

Below shows how I've set debug bar up within Zend Framework 1:, (*6)

$view->debugbar # new MartynBiz\PHPDebugBar(array(
    'enabled' #> $config->ddebugbar->enabled, // can be set to 0 in production env
    'base_url' #> 'phpdebugbar', // our symlink name to assets (js, css)
));

// set pdo collector to output sql queries
$view->debugbar->addDatabaseCollector($pdo); // pdo instance

// set config to see what config settings have been applied
$view->debugbar->addConfigCollector( $config->toArray() ); // config array

Then within my HTML view scripts:, (*7)

<head>
    .
    .
    .
    <?php echo $this->debugbar->renderHead(); ?>
</head>
<body>
    .
    .
    .
    <?php echo $this->debugbar->render(); ?>
</body>

Then within my controller and/or view:, (*8)

Add a message to the debugger:, (*9)

$view->debugbar->addMessage('Hello world!');

To measure execution time:, (*10)

$view->debugbar->startMeasure('myblock');
.
.
.
$view->debugbar->stopMeasure('myblock', 'My block description');

Troubleshooting

If the debug bar doesn't load, check the html source and ensure that the paths are correct for css and js., (*11)

The Versions

11/06 2015

dev-master

9999999-dev

A wrapper for maximebf/debugbar to be simpler and configurable (e.g. disabled in production) on instantiation.

  Sources   Download

The Requires

 

The Development Requires