PHP code example of tracefast / laravel-ai-observability
1. Go to this page and download the library: Download tracefast/laravel-ai-observability 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/ */
tracefast / laravel-ai-observability example snippets
use Tracefast\LaravelAiObservability\Contracts\Exporter;
use Tracefast\LaravelAiObservability\Data\Trace;
final class WebhookExporter implements Exporter
{
public function export(Trace $trace): void
{
// Send $trace->toArray() to your destination.
}
}
use App\Observability\WebhookExporter;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use Tracefast\LaravelAiObservability\AiObservability;
use Tracefast\LaravelAiObservability\Contracts\Exporter;
final class AppServiceProvider extends ServiceProvider
{
public function boot(AiObservability $observability): void
{
$observability->extend(
'webhook',
fn (Application $app, array $config, string $name): Exporter => new WebhookExporter(),
);
}
}