1. Go to this page and download the library: Download entensy/filament-tracer 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/ */
entensy / filament-tracer example snippets
public function panel(Panel $panel): Panel
{
return $panel
...
->plugins([
FilamentTracerPlugin::make()
// You may define how you would like to get tab badge numbers, these must return int type
->tracesCounterUsing(fn($record) => count( explode(PHP_EOL, $record->traces) ) ?? 0)
->queriesCounterUsing(fn($record) => /** return int value */)
->bodyCounterUsing(fn($record) => /** return int value */)
->headersCounterUsing(fn($record) => /** return int value */)
->cookiesCounterUsing(fn($record) => /** return int value */)
]);
}
[
...
// You may implement your own tracer by implementing Tracerable interface
'tracer' => \Entensy\FilamentTracer\DefaultTracer::class,
...
]
use Entensy\FilamentTracer\Contracts\Tracerable;
class MyCustomTracer implements Tracerable
{
//
}
use Entensy\FilamentTracer\Contracts\HasStore;
use Entensy\FilamentTracer\Contracts\Tracerable;
class MyCustomTracer implements Tracerable, HasStore
{
public function store(): mixed
{
$err = $this->getThrowable():
// just log the trace and don't store it in database
logger()->error($err);
return true;
}
}