All Integrations
Languagestigerops/laravel Composer package

Laravel Integration

Auto-instrument Laravel with one Composer install. Eloquent query spans, queue job tracing, Horizon metrics, Blade rendering, and scheduled task visibility — zero configuration.

Setup

How It Works

01

Install via Composer

Run composer require tigerops/laravel. The package auto-registers the TigerOpsServiceProvider via Laravel's package discovery. No manual provider registration is required for Laravel 9+.

02

Publish the Config

Run php artisan vendor:publish --tag=tigerops-config to create config/tigerops.php. Set your API key and service name here or via .env variables. The config file controls all instrumentation toggles.

03

Set Environment Variables

Add TIGEROPS_API_KEY, TIGEROPS_SERVICE_NAME, and TIGEROPS_ENVIRONMENT to your .env file. The config reads these via env() helpers. Forge, Vapor, and Envoyer all support these as server environment variables.

04

Traces, Eloquent & Jobs Flow

Within seconds TigerOps receives Laravel request traces with route name and controller, Eloquent query spans, queue job execution traces, and scheduled artisan command timing.

Capabilities

What You Get Out of the Box

Eloquent ORM Spans

Every Eloquent query creates a child span with normalized SQL, database connection name, row count, and execution time. Model relations (hasMany, belongsTo) triggering lazy loading are flagged as potential N+1 queries.

Queue Job Tracing

Every dispatched and executed queue job creates linked spans. Job class name, queue, connection, payload size, attempt number, backoff delay, and failure reason are all captured as span attributes.

Laravel Horizon Metrics

Horizon supervisor throughput, job runtime, wait time, and failed job counts are scraped from the Horizon Redis data store and pushed to TigerOps as metrics. Works with all Horizon queue drivers.

Blade Template Rendering

View rendering time for each Blade template is captured as a span event on the request trace. Template name, component class, and render duration are tracked — slow views are immediately visible.

Scheduled Task Visibility

Artisan scheduled commands create spans when executed via the task scheduler. Command class, Cron expression, start time, exit code, and output are captured. Missed schedules trigger alerts.

Cache & Redis Spans

Laravel Cache facade operations (get, put, forget, tags) and direct Redis calls become child spans with the cache key, driver, and hit/miss result. Cache stampede patterns are detected and surfaced.

Configuration

Install & Configure

One Composer install. One config publish. Full Laravel observability.

terminal + config/tigerops.php
# Install the TigerOps Laravel package
composer require tigerops/laravel

# Publish the config file
php artisan vendor:publish --tag=tigerops-config

# Add to .env
TIGEROPS_API_KEY=your-api-key
TIGEROPS_SERVICE_NAME=my-laravel-app
TIGEROPS_ENVIRONMENT=production

# config/tigerops.php
<?php

return [
    'api_key'      => env('TIGEROPS_API_KEY'),
    'service_name' => env('TIGEROPS_SERVICE_NAME', 'laravel'),
    'environment'  => env('TIGEROPS_ENVIRONMENT', app()->environment()),

    'instrumentation' => [
        'eloquent'   => true,  // ORM query spans
        'queue'      => true,  // Queue job traces
        'cache'      => true,  // Cache hit/miss spans
        'http'       => true,  // Guzzle outbound
        'schedule'   => true,  // Artisan scheduled tasks
        'blade'      => true,  // View render timing
    ],

    // Horizon metrics (requires Laravel Horizon)
    'horizon' => [
        'enabled'          => true,
        'poll_interval_s'  => 30,
    ],

    'slow_query_threshold_ms' => 100,
];

# Custom span in a controller
use TigerOps\Laravel\Facades\TigerOps;

class CheckoutController extends Controller
{
    public function store(CheckoutRequest $request)
    {
        return TigerOps::span('checkout.process', function ($span) use ($request) {
            $span->setAttribute('cart.id', $request->cart_id);

            $order = DB::transaction(function () use ($request) {
                $order = Order::create($request->validated());
                $this->chargeCard($order);
                $this->sendConfirmation($order);
                return $order;
            });

            $span->setAttribute('order.id', $order->id);
            return redirect()->route('orders.show', $order);
        });
    }
}
FAQ

Common Questions

Which Laravel versions are supported?

Laravel 9, 10, and 11 are fully supported. Laravel 8 is supported on a best-effort basis. The package uses Laravel's service container and auto-discovery, requiring Laravel 8.0+ as a minimum.

Does tigerops/laravel work with Laravel Octane (Swoole/RoadRunner)?

Yes. The package includes Octane lifecycle hooks that reset trace context between requests. Both Swoole coroutine context and RoadRunner fiber context are handled correctly. Add TigerOps::flushOnWorkerStop() in your OctaneServiceProvider.

How does TigerOps integrate with Laravel Vapor (serverless)?

Set TIGEROPS_API_KEY as a Vapor environment variable. The agent runs inside the Lambda execution environment and flushes spans synchronously before the Lambda handler returns using TIGEROPS_FLUSH_ON_EXIT=true.

Can I instrument custom Artisan commands beyond scheduled tasks?

Yes. Add the TigerOps\Laravel\InteractsWithTracing trait to any Artisan command. It automatically creates a root span for the command execution and provides $this->startSpan() and $this->endSpan() helpers.

Does the package capture SQL parameters or only normalized queries?

By default, only normalized queries with parameter placeholders are captured. Enable full query capture with TIGEROPS_CAPTURE_SQL_BINDINGS=true in non-production environments only. This is disabled by default for security.

Get Started

Full Laravel Observability in One Composer Install

Eloquent spans, queue traces, Horizon metrics, and Blade timing — no code changes required.