2017 © Pedro Peláez
 

library firebug

An expandable PHP debugger panel.

image

ua1-labs/firebug

An expandable PHP debugger panel.

  • Sunday, June 24, 2018
  • by joshualjohnson
  • Repository
  • 1 Watchers
  • 1 Stars
  • 49 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 16 Versions
  • 444 % Grown

The README.md

FireBug

An expandable PHP debug panel., (*1)

The true power of FireBug is that it can easily be added to any project and expanded upon! You can even create your own panels to track whatever data you care about while your going through debugging. FireBug comes featured with a Debuggers panel. Which allows you to call debugger() anywhere inside of your application. All debuggers will display the entire debug_trace along with var_dump within the "Debuggers" section of the FireBug Panel., (*2)

Documentation

https://ua1.us/projects/firebug/, (*3)

Installation FireBug Using Composer

composer require ua1-labs/firebug

Enable FireBug

For performance reasons, firebug is initially disabled and needs enabled in order to use it. Here's how:, (*4)

$fireBug = \UA1Labs\Fire\Bug::get();
$fireBug->enable();

FireBug Timer, (*5)

Once FireBug is enabled, it will start a timer that will report how much time it takes to load your page and return your request. Keep in mind, that times are determined by when you enable FireBug., (*6)

Render FireBug

Once you've installed FireBug, it's time to output it somewhere in your HTML., (*7)

$fireBug = \UA1Labs\Fire\Bug::get();
echo $fireBug->render();

When rendering out FireBug, it is suggested that you place it the footer of your application., (*8)

Debugger Panel

As mentioned before, FireBug comes bundled with a "Debuggers" panel. This panel allows you to replace your use of var_dump and debug_trace. When FireBug is installed in your application, all you have to do is call the debugger(mixed $value); function and let FireBug do the work. This function can take any value and will simply var_dump and debug_trace it within the "Debuggers" panel of FireBug., (*9)

Example:, (*10)

debugger('debug value...');

Debuggers also take a second parameter called exit. If you decide you need to exit the execution of any process and render the debug panel at that point in execution, you may do so by passing in true as a second parameter., (*11)

Example:, (*12)

debugger('debug value...', true);

Debugger Panel and X-Debug Overlay

In this project, it was decided to disable x-debug overlay for var_dumps. This makes it easier to read the entire output of debuggers without having to scroll to much left and right. So, if you would like to enable it, here is the code you will want to run when you initize your application., (*13)

$fireBug = \UA1Labs\Fire\Bug::get();
$debuggerPanel = $fireBug->getPanel(\UA1Labs\Fire\Bug\Panel\Debugger::ID);
$debuggerPanel->enableXDebugOverlay();

Creating And Registering Your Own Panel

We've given you everything you need to easily create your own panel., (*14)

  1. Create your own Panel Class:, (*15)

    namespace \UA1Labs\Fire\Bug\Panel;
    
    use \UA1Labs\Fire\Bug\Panel;
    
    class MyOwnPanel extends Panel
    {
        const ID = 'myOwnPanel';
        const NAME = 'My Own Panel';
        const TEMPLATE = '/path-to/my-own-panel.phtml';
    
        public $myName;
    
        public function __construct()
        {
            parent::__construct(self::ID, self::NAME, __DIR__ . self::TEMPLATE);
            $this->myName = 'Testy Testerson';
        }
    
        public function myInfo()
        {
            return '1 Awesome Dude, Orlando, FL, 32708';
        }
    }
  2. Create a panel template file:, (*16)

    <div class="my-own-panel">
        <?php echo $this->myName; ?>
        <?php echo $this->myInfo(); ?>
    </div>
  3. Register Your Panel, (*17)

    $fireBug = Fire\Bug::get();
    $fireBug->addPanel(new \UA1Labs\Fire\Bug\Panel\MyOwnPanel());

Three easy steps and you just added your own panel to FireBug! Now with that being said, here is some info about how it works behind the scenes. Panels act as ViewModels. In the way that any data or methods you add to the panel object itself will also be available to the template object. In the example panel above you can see that the panel was created with a public property called myName and a method myInfo. In the template, you can see we are echoing out these values., (*18)

Timer

FireBug also comes bundled with a timer you may use to detect how much time a process takes. Here's how to use the timer:, (*19)

$fireBug = Fire\Bug::get();
//get a start time
$startTime = $fireBug->timer();
//get time length in milliseconds
$timeLength = $fireBug->timer($startTime);

The Versions

24/06 2018

dev-master

9999999-dev

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

24/06 2018

1.7.2

1.7.2.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

21/06 2018

1.7.1

1.7.1.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

21/06 2018

1.7.0

1.7.0.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

21/06 2018

1.6.1

1.6.1.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

20/06 2018

1.6.0

1.6.0.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

20/06 2018

1.5.0

1.5.0.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

14/06 2018

1.4.2

1.4.2.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

13/06 2018

1.4.1

1.4.1.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

13/06 2018

1.4.0

1.4.0.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

13/06 2018

1.3.0

1.3.0.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

13/06 2018

1.2.0

1.2.0.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

10/06 2018

1.1.1

1.1.1.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

10/06 2018

1.1.0

1.1.0.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

16/05 2018

dev-release-1.0.1

dev-release-1.0.1

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1

16/05 2018

1.0.0

1.0.0.0

An expandable PHP debugger panel.

  Sources   Download

MIT

The Development Requires

by UA1 Labs

test fire debugging var_dump debugger firestudio ua1labs ua1-labs ua1