GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • GitHub
  • DebugBar
  • Documentation
  • Collectors
  • Release Notes
  • Collecting Data
  • Rendering
  • AJAX and Stacked data
  • Data Formatter
  • Storage
  • Open handler
  • HTTP drivers
  • Javascript Bar
  • Bridge collectors

This view

  • Original page
  • New address

GeezerVison is showing php-debugbar.com — Getting started - PHP Debug Bar

Getting started

Installation¶

The best way to install DebugBar is using Composer with the following command:

composer require --dev php-debugbar/php-debugbar

Quick start¶

DebugBar is very easy to use and you can add it to any of your projects in no time. The easiest way is using the render() functions

<?php

// Require the Composer autoloader, if not already loaded
require 'vendor/autoload.php';

use DebugBar\StandardDebugBar;

$debugbar = new StandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer();

$debugbar["messages"]->addMessage("hello world!");
?>
<html>
    <head>
        <?php echo $debugbarRenderer->renderHead() ?>
    </head>
    <body>
        ...
        <?php echo $debugbarRenderer->render() ?>
    </body>
</html>

The DebugBar uses DataCollectors to collect data from your PHP code. Some of them are automated but others are manual. Use the DebugBar like an array where keys are the collector names. In our previous example, we add a message to the MessagesCollector:

$debugbar["messages"]->addMessage("hello world!");

StandardDebugBar activates the following collectors:

  • MemoryCollector (memory)
  • MessagesCollector (messages)
  • PhpInfoCollector (php)
  • RequestDataCollector (request)
  • TimeDataCollector (time)
  • ExceptionsCollector (exceptions)

Learn more about DebugBar in the docs.

Demo¶

To run the demo, clone this repository and start the Built-In PHP webserver from the root:

php -S localhost:8000

Then visit http://localhost:8000/demo/

Testing¶

To test, run php vendor/bin/phpunit. To debug Browser tests, you can run PANTHER_NO_HEADLESS=1 vendor/bin/phpunit --debug. Run vendor/bin/bdi detect drivers to download the latest drivers.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.