darkenphp/debugbar

There is no license information available for the latest version (dev-main) of this package.

A Darken boilerplate for creating a new extension.

dev-main 2025-08-23 05:46 UTC

This package is auto-updated.

Last update: 2025-08-23 05:46:51 UTC


README

  1. Composer

Install the debugbar extension. add it to require dev section: composer require darkenphp/debugbar:dev-main --dev

  1. Configure Extension

Now add the extension in your app/Config.php to the extensions() method:

 public function extensions(ExtensionService $service): ExtensionService
    {
        return $service
            ->register(new \Darken\Debugbar\Build\Extension(new \Darken\Debugbar\DebugBarConfig(
                isActive: $this->getDebugMode()
            )));
    }

The isActive property of the DebugBarConfig controls, whether the Debugbar is visible or not, we directly connect this to the currents configuraiton getDebugMode() method.

  1. Using

You can now Inject the DebugBarConfig anywhere and start using message and start/top methods, an example:

#[\Darken\Attributes\Inject]
public \Darken\Debugbar\DebugBarConfig $debug;

public function getBlogs()
{
    $this->debug->message('Fetching blog list');

    $this->debug->start('fetch_blog_list', 'Retrieving blog list');
    $items = $this->blogs->getItems();
    $this->debug->stop('fetch_blog_list');

    return $items;
}