Get telemetry flowing from a PHP application in under 5 minutes.
composer require telemetryflow/php-nativeNeed the gRPC transport? Install the grpc PHP extension. The HTTP transport works with no extra extensions.
Create a .env (or export these variables):
TELEMETRYFLOW_API_KEY_ID=tfk_your_key_id
TELEMETRYFLOW_API_KEY_SECRET=tfs_your_key_secret
TELEMETRYFLOW_ENDPOINT=localhost:4317
TELEMETRYFLOW_SERVICE_NAME=my-php-service
TELEMETRYFLOW_SERVICE_VERSION=1.0.0
TELEMETRYFLOW_ENVIRONMENT=development
TELEMETRYFLOW_INSECURE=true<?php
declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
use TelemetryFlow\Core\TelemetryFlow;
$client = TelemetryFlow::newFromEnv();
$client->initialize();
// Metric
$client->incrementCounter('api.requests', 1, ['method' => 'GET']);
// Log
$client->logInfo('Started up', ['version' => '1.0.0']);
// Trace
$spanId = $client->startSpan('handle-request', 'server');
// ... your code ...
$client->endSpan($spanId);
// Always flush on shutdown
$client->shutdown();Run the TFO-Collector locally (it listens on :4317 gRPC / :4318 HTTP) and your telemetry appears in the TelemetryFlow dashboard.
For explicit control:
use TelemetryFlow\Core\Builder;
$client = Builder::create()
->withApiKey('tfk_...', 'tfs_...')
->withEndpoint('api.telemetryflow.id:4317')
->withService('my-app', '2.0.0')
->withHttp() // or withGrpc()
->withSignals(true, true, true) // metrics, logs, traces
->withCustomAttribute('team', 'backend')
->build();
$client->initialize();composer require telemetryflow/laravel
php artisan vendor:publish --tag=telemetryflow-configuse TelemetryFlow\Laravel\Facades\TelemetryFlow;
TelemetryFlow::incrementCounter('orders.created');See the Laravel README for middleware, logging, and Guzzle instrumentation.
- Architecture — DDD + CQRS layering
- API Reference — full method documentation
- Examples — runnable sample apps