The TrustPort Beacon Laravel SDK (trustportidentity/beacon-laravel) auto-registers via Laravel package discovery and tracks HTTP requests, database queries, and background jobs with almost zero overhead.
The service provider and Beacon facade are auto-discovered β no manual registration needed:
composer require trustportidentity/beacon-laravelAdd these to your .env file:
BEACON_INGEST_URL=https://beacon-api.trustportidentity.com
BEACON_API_KEY=tb_live_your_tenant_key
BEACON_SERVICE_NAME=billing-api
BEACON_ENVIRONMENT=productionAdd BeaconMiddleware to your HTTP kernel so every request is traced:
use TrustPortIdentity\Beacon\BeaconMiddleware;
protected $middleware = [
BeaconMiddleware::class,
// ...your other global middleware
];use TrustPortIdentity\Beacon\Beacon;
class InvoiceController extends Controller
{
public function index()
{
$span = Beacon::span('db.mysql.select_invoices', 'database');
$invoices = Invoice::where('status', 'pending')->get();
$span->setTag('rows', $invoices->count())->end();
Beacon::identify(['id' => auth()->id(), 'email' => auth()->user()?->email]);
return response()->json($invoices);
}
}Wrap a job's handle() body in a Beacon::span(..., 'job') to track queue processing time and failures the same way HTTP requests are tracked.
Every request is already batched (BEACON_BATCH_SIZE) instead of one network call per request. On top of that, set BEACON_SAMPLE_RATE (0.0β1.0, default 1.0) to trace only a fraction of requests in high-traffic services β this is what actually keeps you inside your plan's monthly quota. Exceptions are always sent regardless of sampling.
BEACON_SAMPLE_RATE=0.2 # trace ~20% of requestsOur engineers can help tune the batching interval for long-running workers.