1. Go to this page and download the library: Download datlechin/flarum-debugbar library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
datlechin / flarum-debugbar example snippets
'debug' => true,
use Datlechin\FlarumDebugbar\Debugbar;
class WidgetService
{
public function __construct(protected Debugbar $debugbar) {}
public function build(): Widget
{
$this->debugbar->info('Building the widget');
return $this->debugbar->measure('Widget build', function () {
// ... expensive work, which now has its own bar on the timeline
});
}
}
// src/Collector/WidgetCollector.php
use Datlechin\FlarumDebugbar\Collector\CollectorInterface;
class WidgetCollector implements CollectorInterface
{
public function name(): string
{
return 'widgets';
}
public function collect(ServerRequestInterface $request, ResponseInterface $response): array
{
return ['count' => 3, 'names' => ['alpha', 'beta', 'gamma']];
}
}
// extend.php
return [
(new Datlechin\FlarumDebugbar\Extend\Debugbar())
->collector(Acme\Collector\WidgetCollector::class),
];
public function subscribe(Dispatcher $events): void
{
$events->listen(WidgetRendered::class, $this->record(...));
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.