Skip to content

The only tool you need to know what is happening and how to fix it.

docs: added laravel support (#140)

Jovan Stojiljkovicd3f6f96a33d4
diff --git a/backend/app/controllers/project.controller.go b/backend/app/controllers/project.controller.go
index 51962cd8..730a652e 100644
--- a/backend/app/controllers/project.controller.go
+++ b/backend/app/controllers/project.controller.go
@@ -40,6 +40,7 @@ var validFrameworks = map[string]bool{
"opentelemetry": true,
// PHP frameworks
"symfony": true,
+ "laravel": true,
// Mobile frameworks
"flutter": true,
"android": true,
@@ -90,7 +91,7 @@ func (p projectController) CreateProject(c *gin.Context) {
if !validFrameworks[request.Framework] {
traceway.CaptureMessage("Invalid framework received: " + request.Framework)
- c.JSON(http.StatusBadRequest, gin.H{"error": "Framework must be one of: gin, fiber, chi, fasthttp, stdlib, custom, react, svelte, vuejs, jquery, react-native, hono, cloudflare, opentelemetry, symfony, flutter, android"})
+ c.JSON(http.StatusBadRequest, gin.H{"error": "Framework must be one of: gin, fiber, chi, fasthttp, stdlib, custom, react, svelte, vuejs, jquery, react-native, hono, cloudflare, opentelemetry, symfony, laravel, flutter, android"})
return
}
diff --git a/docs/components/FrameworkPicker.jsx b/docs/components/FrameworkPicker.jsx
index 7ce0b873..f5554b13 100644
--- a/docs/components/FrameworkPicker.jsx
+++ b/docs/components/FrameworkPicker.jsx
@@ -34,6 +34,14 @@ const FRAMEWORKS = [
href: "/client/symfony",
badge: "production",
},
+ {
+ value: "php-laravel",
+ label: "Laravel",
+ description: "Laravel framework with OpenTelemetry auto-instrumentation.",
+ icon: "/laravel.png",
+ href: "/client/laravel",
+ badge: "production",
+ },
{
value: "go-gin",
label: "Go Gin",
diff --git a/docs/components/SdkContext.jsx b/docs/components/SdkContext.jsx
index 3cce42f0..5f09f763 100644
--- a/docs/components/SdkContext.jsx
+++ b/docs/components/SdkContext.jsx
@@ -21,6 +21,7 @@ export const SDK_OPTIONS = [
{ value: 'cloudflare', label: 'Cloudflare Workers' },
{ value: 'js-nextjs', label: 'Next.js (OTel)' },
{ value: 'php-symfony', label: 'Symfony' },
+ { value: 'php-laravel', label: 'Laravel' },
{ value: 'flutter', label: 'Flutter' },
{ value: 'android', label: 'Android' },
{ value: 'react-native', label: 'React Native' },
@@ -51,6 +52,7 @@ const PATH_SDK_MAP = {
'cloudflare': 'cloudflare',
'nextjs': 'js-nextjs',
'symfony': 'php-symfony',
+ 'laravel': 'php-laravel',
'flutter': 'flutter',
'android': 'android',
}
diff --git a/docs/pages/client/_meta.json b/docs/pages/client/_meta.json
index d037cbf0..e4b1082e 100644
--- a/docs/pages/client/_meta.json
+++ b/docs/pages/client/_meta.json
@@ -24,6 +24,7 @@
"otel": "OpenTelemetry",
"cloudflare": "Cloudflare Workers",
"symfony": "Symfony",
+ "laravel": "Laravel",
"flutter": "Flutter",
"android": "Android",
"react-native": "React Native"
diff --git a/docs/pages/client/laravel/_meta.json b/docs/pages/client/laravel/_meta.json
new file mode 100644
index 00000000..0aa51d6b
--- /dev/null
+++ b/docs/pages/client/laravel/_meta.json
@@ -0,0 +1,8 @@
+{
+ "index": "Quick Start",
+ "exceptions": "Exceptions",
+ "spans": "Spans",
+ "tasks": "Tasks",
+ "metrics": "Metrics",
+ "logs": "Logs"
+}
diff --git a/docs/pages/client/laravel/exceptions.mdx b/docs/pages/client/laravel/exceptions.mdx
new file mode 100644
index 00000000..36e83d9d
--- /dev/null
+++ b/docs/pages/client/laravel/exceptions.mdx
@@ -0,0 +1,169 @@
+# Exceptions
+
+`keepsuit/laravel-opentelemetry` records unhandled exceptions automatically. The package's service provider registers a global `reportable()` callback on Laravel's exception handler that calls `$span->recordException($e)` and `$span->setStatus(STATUS_ERROR)` on the currently-active span. So:
+
+- Any exception thrown from a **controller / route closure** is captured on the request span (which becomes a Traceway Issue).
+- Any exception thrown from a **queued job** that triggers a `JobFailed` event is captured on the consumer span by `QueueInstrumentation`.
+- Any exception thrown inside `Tracer::newSpan(...)->measure(fn)` is captured by `measure()` (see [Spans](/client/laravel/spans) for one caveat about span status).
+- Any exception that propagates through Laravel's `report()` pipeline — including ones you catch and rethrow via `throw $e` — also goes through the reportable callback and is recorded on whatever span is active at that moment.
+
+You only need the patterns on this page when:
+1. You **catch** an exception and don't rethrow it, so Laravel's reporter never sees it.
+2. You want to attach **extra context** (user id, request id, business attributes) to the auto-captured exception event.
+
+## Recording an Exception on the Current Span
+
+When you catch an error but don't rethrow, record it manually:
+
+## Recording an Exception on the Current Span
+
+When you catch an error but want it reported to Traceway, record it as an event on the active span:
+
+```php
+use OpenTelemetry\API\Trace\Span;
+use OpenTelemetry\API\Trace\StatusCode;
+
+try {
+ $this->paymentGateway->charge($order);
+} catch (\Throwable $e) {
+ $span = Span::getCurrent();
+ $span->recordException($e);
+ $span->setStatus(StatusCode::STATUS_ERROR, $e->getMessage());
+
+ throw $e;
+}
+```
+
+`recordException` adds an `exception` event to the span with the type, message, and stack trace. Traceway extracts these events and creates Issues from them.
+
+## Adding Attributes to Exceptions
+
+Add context by setting span attributes before or after recording the exception:
+
+```php
+use OpenTelemetry\API\Trace\Span;
+use OpenTelemetry\API\Trace\StatusCode;
+
+$span = Span::getCurrent();
+
+$span->setAttribute('user.id', $userId);
+$span->setAttribute('order.id', $orderId);
+
+try {
+ $this->processOrder($orderId);
+} catch (\Throwable $e) {
+ $span->recordException($e, [
+ 'order.status' => 'failed',
+ 'retry.count' => $retryCount,
+ ]);
+ $span->setStatus(StatusCode::STATUS_ERROR, $e->getMessage());
+ throw $e;
+}
+```
+
+The additional attributes passed to `recordException` are attached to the exception event itself.
+
+## Adding Context to the Auto-Capture
+
+The package's built-in `reportable()` callback runs **before** any callback you register, but you can register your own to add request-level attributes to the span before the exception event is finalized. Use this when you want every error to carry the same diagnostic fields:
+
+### Laravel 11 / 12
+
+```php
+// bootstrap/app.php
+
+use Illuminate\Foundation\Application;
+use Illuminate\Foundation\Configuration\Exceptions;
+use OpenTelemetry\API\Trace\Span;
+use OpenTelemetry\API\Trace\StatusCode;
+
+return Application::configure(basePath: dirname(__DIR__))
+ ->withRouting(/* ... */)
+ ->withExceptions(function (Exceptions $exceptions) {
+ $exceptions->report(function (\Throwable $e) {
+ // The package already calls recordException + setStatus(ERROR) on
+ // the active span — here we just attach extra attributes.
+ $span = Span::getCurrent();
+ $span->setAttribute('request.id', request()->header('X-Request-Id'));
+ $span->setAttribute('user.id', optional(auth()->user())->id);
+ });
+ })
+ ->create();
+```
+
+### Laravel 10
+
+```php
+// app/Exceptions/Handler.php
+use OpenTelemetry\API\Trace\Span;
+
+public function register(): void
+{
+ $this->reportable(function (\Throwable $e) {
+ // The package already calls recordException + setStatus(ERROR) on
+ // the active span — here we just attach extra attributes.
+ $span = Span::getCurrent();
+ $span->setAttribute('request.id', request()->header('X-Request-Id'));
+ $span->setAttribute('user.id', optional(auth()->user())->id);
+ });
+}
+```
+
+## Capturing Exceptions in Services
+
+For exceptions in services outside a controller, get the current span from context:
+
+```php
+namespace App\Services;
+
+use OpenTelemetry\API\Trace\Span;
+use OpenTelemetry\API\Trace\StatusCode;
+
+class PaymentService
+{
+ public function processPayment(string $customerId, float $amount): void
+ {
+ $span = Span::getCurrent();
+
+ try {
+ $this->gateway->charge($customerId, $amount);
+ } catch (\Throwable $e) {
+ $span->recordException($e, [
+ 'customer.id' => $customerId,
+ 'payment.amount' => $amount,
+ ]);
+ $span->setStatus(StatusCode::STATUS_ERROR, $e->getMessage());
+ throw $e;
+ }
+ }
+}
+```
+
+## Custom Exception Types
+
+Custom exception classes work the same way — their type name appears in the Traceway dashboard:
+
+```php
+class InsufficientFundsException extends \RuntimeException
+{
+ public function __construct(
+ public readonly string $accountId,
+ public readonly float $requested,
+ public readonly float $available,
+ ) {
+ parent::__construct("Insufficient funds: requested {$requested}, available {$available}");
+ }
+}
+
+try {
+ $this->withdraw($accountId, $amount);
+} catch (InsufficientFundsException $e) {
+ $span = Span::getCurrent();
+ $span->recordException($e, [
+ 'account.id' => $e->accountId,
+ 'amount.requested' => $e->requested,
+ 'amount.available' => $e->available,
+ ]);
+ $span->setStatus(StatusCode::STATUS_ERROR, $e->getMessage());
+}
+```
diff --git a/docs/pages/client/laravel/index.mdx b/docs/pages/client/laravel/index.mdx
new file mode 100644
index 00000000..6c2a2668
--- /dev/null
+++ b/docs/pages/client/laravel/index.mdx
@@ -0,0 +1,171 @@
+# Laravel
+
+The [`keepsuit/laravel-opentelemetry`](https://github.com/keepsuit/laravel-opentelemetry) package automatically instruments your Laravel application and exports traces, metrics, and logs to Traceway's OTLP endpoints — no manual instrumentation needed.
+
+## Prerequisites
+
+- PHP 8.2+
+- Laravel 10, 11, or 12
+- Composer
+- A Traceway project (create one in the dashboard)
+
+## Step 1: Install Packages
+
+```bash
+composer require keepsuit/laravel-opentelemetry open-telemetry/exporter-otlp php-http/guzzle7-adapter
+```
+
+The `open-telemetry/exporter-otlp` and `php-http/guzzle7-adapter` packages provide the OTLP/HTTP exporter and its HTTP client. They are required at runtime to actually ship spans to Traceway.
+
+## Step 2: Publish the Config
+
+```bash
+php artisan vendor:publish \
+ --provider="Keepsuit\LaravelOpenTelemetry\LaravelOpenTelemetryServiceProvider" \
+ --tag="opentelemetry-config"
+```
+
+This creates `config/opentelemetry.php` where you can disable individual instrumentations, configure sampling, set propagators, and tune exporter settings.
+
+## Step 3: Configure Environment Variables
+
+Add the following to your `.env` file, replacing the endpoint and token with your project values:
+
+```bash
+OTEL_SERVICE_NAME=my-laravel-app
+OTEL_TRACES_EXPORTER=otlp
+OTEL_METRICS_EXPORTER=otlp
+OTEL_LOGS_EXPORTER=otlp
+OTEL_EXPORTER_OTLP_PROTOCOL=http/json
+OTEL_EXPORTER_OTLP_ENDPOINT=https://your-traceway-instance.com/api/otel
+OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer your-project-token"
+```
+
+Your Traceway dashboard includes a **Connection** page with a ready-made config snippet and your project token. Go to **Connection** in the sidebar to grab it.
+
+> **Note:** Use `http/json` instead of `http/protobuf`. The protobuf encoder has known deprecation warnings on PHP 8.4+ that can cause noisy logs. The package defaults to `http/protobuf` — explicitly set `http/json` if you see deprecation noise.
+
+That's it. The package's service provider auto-registers `Keepsuit\LaravelOpenTelemetry\Support\HttpServer\TraceRequestMiddleware` as a global middleware, so every inbound HTTP request is now traced — no manual middleware registration needed.
+
+## Tune Which Instrumentations Are Enabled
+
+The package's instrumentation list lives in the `instrumentation` array of `config/opentelemetry.php`. Each entry can be removed (to disable it) or toggled per-environment via the matching env var. A reasonable default — what ships out of the box — is:
+
+```php
+// config/opentelemetry.php
+use Keepsuit\LaravelOpenTelemetry\Instrumentation;
+
+return [
+ // ...
+ 'instrumentation' => [
+ Instrumentation\HttpServerInstrumentation::class => [
+ 'enabled' => env('OTEL_INSTRUMENTATION_HTTP_SERVER', true),
+ 'excluded_paths' => ['/health', '/up'],
+ 'excluded_methods' => [],
+ 'allowed_headers' => [],
+ 'sensitive_headers' => [],
+ ],
+
+ Instrumentation\HttpClientInstrumentation::class => [
+ 'enabled' => env('OTEL_INSTRUMENTATION_HTTP_CLIENT', true),
+ 'manual' => false,
+ ],
+
+ Instrumentation\QueryInstrumentation::class => env('OTEL_INSTRUMENTATION_QUERY', true),
+ Instrumentation\RedisInstrumentation::class => env('OTEL_INSTRUMENTATION_REDIS', true),
+ Instrumentation\QueueInstrumentation::class => env('OTEL_INSTRUMENTATION_QUEUE', true),
+ Instrumentation\CacheInstrumentation::class => env('OTEL_INSTRUMENTATION_CACHE', true),
+ Instrumentation\ViewInstrumentation::class => env('OTEL_INSTRUMENTATION_VIEW', true),
+ Instrumentation\LivewireInstrumentation::class => env('OTEL_INSTRUMENTATION_LIVEWIRE', true),
+
+ Instrumentation\ConsoleInstrumentation::class => [
+ 'enabled' => env('OTEL_INSTRUMENTATION_CONSOLE', true),
+ 'commands' => [],
+ ],
+ ],
+];
+```
+
+| Instrumentation | What it captures |
+|-----------------|------------------|
+| `HttpServerInstrumentation` | Inbound HTTP requests, status codes, route templates (`http.route`) |
+| `HttpClientInstrumentation` | Outbound `Http::` / Guzzle calls |
+| `QueryInstrumentation` | Eloquent / DB queries with SQL and timing |
+| `RedisInstrumentation` | Redis commands |
+| `QueueInstrumentation` | Queued jobs — `PRODUCER` span at dispatch, `CONSUMER` span at execute (see [Tasks](/client/laravel/tasks)) |
+| `CacheInstrumentation` | Cache hits / misses / writes (as span events) |
+| `ViewInstrumentation` | Blade view rendering |
+| `LivewireInstrumentation` | Livewire component renders |
+| `ConsoleInstrumentation` | Artisan commands — **opt-in per command**, see [Tasks](/client/laravel/tasks) |
+| `ScoutInstrumentation` | Laravel Scout (requires the `opentelemetry` PHP extension) |
+
+Disable any instrumentation you don't want by removing it from the array or setting the matching env var to `false`. Every enabled instrumentation adds a small amount of overhead.
+
+> **Exceptions:** there is no separate "exception" instrumentation. The package's service provider hooks Laravel's exception handler via `reportable()` and calls `$span->recordException($e)` + `setStatus(ERROR)` on the active span for every reported exception. Queue failures are captured by `QueueInstrumentation` on the `JobFailed` event. See [Exceptions](/client/laravel/exceptions) for adding extra context to caught errors.
+
+## What Gets Captured
+
+Once configured, the package automatically captures:
+
+- **Endpoints** — every HTTP request with method and route template (e.g., `GET /users/{id}`)
+- **Status codes** — 2xx, 4xx, 5xx responses
+- **Exceptions** — recorded on the request span with stack traces
+- **Database queries** — Eloquent / DB facade queries with statement and duration
+- **Outbound HTTP** — `Http::` facade and Guzzle calls
+- **Cache & Redis** — keys, hits, misses
+- **Queued jobs** — `PRODUCER` + `CONSUMER` spans (see [Tasks](/client/laravel/tasks))
+- **User context** — the authenticated user's id is added as `user.id` to every span and log (configurable via `opentelemetry.user_context`)
+
+## User Context
+
+When `opentelemetry.user_context` is `true` (the default), the authenticated user's id is attached as `user.id` to every span and log. You can customize the attributes:
+
+```php
+// app/Providers/AppServiceProvider.php
+use Illuminate\Contracts\Auth\Authenticatable;
+use Keepsuit\LaravelOpenTelemetry\Facades\OpenTelemetry;
+
+public function boot(): void
+{
+ OpenTelemetry::user(function (Authenticatable $user) {
+ return [
+ 'user.id' => $user->getAuthIdentifier(),
+ 'user.email' => $user->email,
+ ];
+ });
+}
+```
+
+## Octane / Horizon / Queue Workers
+
+The package detects worker mode automatically (Octane, Horizon, default queue workers). By default, span exports are batched and flushed periodically or on process shutdown. If you want every iteration (request, job) to flush immediately, set:
+
+```bash
+OTEL_WORKER_MODE_FLUSH_AFTER_EACH_ITERATION=true
+```
+
+This trades a small amount of throughput for guaranteed delivery of every span — useful in low-traffic apps where the next flush might be far away.
+
+## Test Your Integration
+
+Add a test route to verify data is flowing:
+
+```php
+// routes/web.php
+use Illuminate\Support\Facades\Route;
+
+Route::get('/testing', function () {
+ throw new \RuntimeException('Test error from Traceway integration');
+});
+```
+
+Visit `/testing` in your browser, then check the Traceway dashboard — the exception should appear within a few seconds.
+
+## Next Steps
+
+- [Exceptions](/client/laravel/exceptions) — manually capture caught exceptions with context
+- [Spans](/client/laravel/spans) — create custom spans to measure sub-operations
+- [Tasks](/client/laravel/tasks) — trace Laravel queue jobs and console commands as background tasks
+- [Metrics](/client/laravel/metrics) — track custom counters, histograms, and gauges with the `Meter` facade
+- [Logs](/client/laravel/logs) — forward Laravel logs to Traceway via the auto-injected `otlp` channel
+- [OpenTelemetry docs](/client/otel) — how OTel traces, metrics, and logs map to Traceway
diff --git a/docs/pages/client/laravel/logs.mdx b/docs/pages/client/laravel/logs.mdx
new file mode 100644
index 00000000..2fd41873
--- /dev/null
+++ b/docs/pages/client/laravel/logs.mdx
@@ -0,0 +1,183 @@
+# Logs
+
+`keepsuit/laravel-opentelemetry` auto-injects an `otlp` log channel that bridges Laravel's standard logger to the OpenTelemetry Logs SDK and OTLP exporter. Once configured, every `Log::info(...)` / `Log::error(...)` routed through that channel is forwarded to Traceway and linked to the active trace and span.
+
+## Step 1: Enable the OTLP Logs Exporter
+
+Extend the env config from the [Quick Start](/client/laravel) to also enable the logs exporter:
+
+```bash
+# Existing traces + metrics config from the Quick Start
+OTEL_SERVICE_NAME=my-laravel-app
+OTEL_TRACES_EXPORTER=otlp
+OTEL_METRICS_EXPORTER=otlp
+
+# Enable OTLP logs
+OTEL_LOGS_EXPORTER=otlp
+
+OTEL_EXPORTER_OTLP_PROTOCOL=http/json
+OTEL_EXPORTER_OTLP_ENDPOINT=https://your-traceway-instance.com/api/otel
+OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer your-project-token"
+```
+
+`OTEL_EXPORTER_OTLP_ENDPOINT` is the base URL — the logs exporter appends `/v1/logs` automatically. No extra endpoint config is needed.
+
+## Step 2: Use the `otlp` Channel
+
+The package's service provider **automatically injects** a log channel named `otlp` into `config/logging.php` at runtime — no manual channel registration is required. You just need to point your default log destination at it.
+
+The simplest path: set `LOG_CHANNEL=otlp` in your `.env` to send every log directly to Traceway.
+
+If you'd rather keep file logs and ship a copy to Traceway, switch your default channel to a stack:
+
+```bash
+# .env
+LOG_CHANNEL=stack
+```
+
+```php
+// config/logging.php
+'channels' => [
+ 'stack' => [
+ 'driver' => 'stack',
+ 'channels' => ['single', 'otlp'],
+ 'ignore_exceptions' => false,
+ ],
+
+ 'single' => [
+ 'driver' => 'single',
+ 'path' => storage_path('logs/laravel.log'),
+ 'level' => env('LOG_LEVEL', 'debug'),
+ ],
+
+ // The 'otlp' channel is auto-injected — but you can override it here if
+ // you want to change the level threshold or the handler config.
+ // 'otlp' => [
+ // 'driver' => 'monolog',
+ // 'handler' => \Keepsuit\LaravelOpenTelemetry\Support\OpenTelemetryMonologHandler::class,
+ // 'level' => 'info',
+ // ],
+],
+```
+
+The stack fans every log out to both the local file (`single`) and Traceway (`otlp`). Drop the `single` channel if you do not want local files.
+
+> The default `otlp` channel level is `debug`. To reduce volume in production, override the channel as shown in the commented block above and raise the level (`info`, `warning`, …). Only records at or above the threshold are forwarded.
+
+## Emit Logs With Trace Context
+
+Use Laravel's standard `Log` facade as usual. Because handlers run inside the package's HTTP-request / queue-job span, every log emitted here carries that span's `trace_id` and `span_id` automatically:
+
+```php
+// app/Http/Controllers/OrderController.php
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Log;
+
+class OrderController extends Controller
+{
+ public function store(Request $request)
+ {
+ Log::info('order received', ['order.id' => 'ord_123']);
+
+ try {
+ // ... business logic ...
+ Log::info('order processed', ['order.id' => 'ord_123']);
+ return response()->json(['status' => 'ok']);
+ } catch (\Throwable $e) {
+ Log::error('order failed', [
+ 'order.id' => 'ord_123',
+ 'exception' => $e->getMessage(),
+ ]);
+ throw $e;
+ }
+ }
+}
+```
+
+Open the endpoint's trace in the Traceway dashboard and the **Logs** tab will show these records attached. The same is true for logs emitted inside queue jobs, Artisan commands, and any other code that runs under an active span.
+
+## Inject `trace_id` Into Non-OTLP Loggers
+
+If you also write logs to `single` / `daily` files (or any non-OTLP channel), the package can inject the active trace id into Laravel's log context so it shows up alongside the message. This is enabled by default for instrumentation-started spans. If you start a root span manually with `Tracer::newSpan(...)->start()`, call:
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Tracer;
+
+$span = Tracer::newSpan('cron.cleanup')->start();
+$scope = $span->activate();
+
+Tracer::updateLogContext(); // makes 'trace_id' available to subsequent Log:: calls
+
+try {
+ // ... work ...
+} finally {
+ $scope->detach();
+ $span->end();
+}
+```
+
+The context field name is configurable via `opentelemetry.logs.trace_id_field` (default: `trace_id`).
+
+## Logger Facade (Alternative)
+
+For code paths where you want to send a record straight to Traceway without involving Monolog's pipeline, the package also exposes a `Logger` facade. It's particularly handy in low-level contexts where the standard `Log::` facade isn't available:
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Logger;
+
+Logger::emergency('process crashed');
+Logger::alert('database is unreachable');
+Logger::critical('config is broken');
+Logger::error('order failed', ['order.id' => 'ord_1']);
+Logger::warning('rate limit reached', ['user.id' => 42]);
+Logger::notice('feature flag flipped');
+Logger::info('order received');
+Logger::debug('cache hit');
+```
+
+These records go directly to the OTLP logs exporter and are linked to the active trace, identical to records routed through the `otlp` log channel.
+
+## Severity Mapping
+
+Laravel uses Monolog under the hood, so its levels are mapped to OpenTelemetry severity numbers (and Traceway's TRACE → FATAL labels) as follows:
+
+| Laravel / Monolog Level | OTLP Severity Number | Traceway Severity |
+| ----------------------- | -------------------- | ----------------- |
+| `debug` | 5 | DEBUG |
+| `info` | 9 | INFO |
+| `notice` | 10 | INFO |
+| `warning` | 13 | WARN |
+| `error` | 17 | ERROR |
+| `critical` | 18 | ERROR |
+| `alert` | 19 | ERROR |
+| `emergency` | 21 | FATAL |
+
+Only records at or above the channel's configured `level` threshold are forwarded.
+
+## Test Your Integration
+
+Add a route that logs at multiple levels, hit it once, and check the **Logs** page in the Traceway dashboard:
+
+```php
+// routes/web.php
+use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\Route;
+
+Route::get('/log-test', function () {
+ Log::debug('debug sample');
+ Log::info('info sample', ['request.id' => 'req_1']);
+ Log::warning('warning sample');
+ Log::error('error sample', ['order.id' => 'ord_1']);
+ return response()->json(['emitted' => 4]);
+});
+```
+
+Visit `/log-test`, then open **Logs** in the dashboard. You should see records at or above your `otlp` channel's `level` within a few seconds, each linked to the trace for that request.
+
+## Next Steps
+
+- [Exceptions](/client/laravel/exceptions) — record caught exceptions with context
+- [Metrics](/client/laravel/metrics) — custom counters, histograms, and gauges
+- [OTel Logs reference](/client/otel/logs) — full OTLP logs mapping and severity details
diff --git a/docs/pages/client/laravel/metrics.mdx b/docs/pages/client/laravel/metrics.mdx
new file mode 100644
index 00000000..1410104e
--- /dev/null
+++ b/docs/pages/client/laravel/metrics.mdx
@@ -0,0 +1,183 @@
+# Metrics
+
+The OTel auto-instrumentation captures default request, DB, queue, and outbound-HTTP metrics automatically (e.g., `http.server.request.duration`, `http.client.request.duration`, `db.client.operation.duration`). To track custom application metrics, use the `Meter` facade.
+
+## The `Meter` Facade
+
+`keepsuit/laravel-opentelemetry` ships a `Meter` facade that gives you direct access to all OTel instrument types. Instruments are cached by name, so calling `Meter::counter('orders.created')` twice returns the same counter — safe to call from anywhere.
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Meter;
+
+$counter = Meter::counter('orders.created', 'orders', 'Total orders created');
+$counter->add(1);
+```
+
+## Supported Instruments
+
+| Method | Use case |
+|--------|----------|
+| `Meter::counter($name, $unit, $description)` | Monotonic counter (only goes up) |
+| `Meter::upDownCounter(...)` | Counter that can go up or down |
+| `Meter::observableCounter(...)` | Counter whose value is read via callback at export time |
+| `Meter::observableUpDownCounter(...)` | Up/down counter read via callback |
+| `Meter::gauge(...)` | Synchronous gauge — record a value at a point in time |
+| `Meter::observableGauge(...)` | Gauge read via callback at export time |
+| `Meter::histogram($name, $unit, $description)` | Distribution of values (durations, sizes) |
+
+## Counter
+
+Counters track cumulative values that only go up (total orders, requests processed):
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Meter;
+
+$orderCounter = Meter::counter('orders.created', 'orders', 'Total orders created');
+
+// Increment by 1
+$orderCounter->add(1);
+
+// Increment with attributes
+$orderCounter->add(1, ['plan' => 'pro', 'region' => 'eu']);
+```
+
+## Histogram
+
+Histograms track distributions of values (response times, payload sizes):
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Meter;
+
+$durationHistogram = Meter::histogram('order.processing_ms', 'ms', 'Order processing time');
+
+$start = hrtime(true);
+$this->processOrder($order);
+$durationMs = (hrtime(true) - $start) / 1e6;
+
+$durationHistogram->record($durationMs, ['plan' => $order->plan]);
+```
+
+Traceway converts histograms into average and count metrics (see [OTel metrics](/client/otel/metrics#histogram-handling)).
+
+## Gauge
+
+Gauges track point-in-time values that can go up or down (queue depth, active connections):
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Meter;
+
+// Synchronous — record a value when you know it
+$gauge = Meter::gauge('cache.size_mb', 'MB', 'Cache memory usage');
+$gauge->record(42.3);
+
+// Observable — value is read by a callback at export time
+Meter::observableGauge('queue.depth', 'items', 'Pending jobs in the default queue')
+ ->observe(function ($observer) {
+ $observer->observe(\Queue::size('default'));
+ });
+```
+
+## Batch Observation
+
+When several observable instruments share an expensive data source, use `batchObserve` so the source is only consulted once per export cycle:
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Meter;
+use OpenTelemetry\API\Metrics\ObserverInterface;
+
+Meter::batchObserve([
+ Meter::observableCounter('usage', description: 'count of items used'),
+ Meter::observableGauge('pressure', description: 'force per unit area'),
+], function (ObserverInterface $usageObserver, ObserverInterface $pressureObserver): void {
+ [$usage, $pressure] = expensive_system_call();
+ $usageObserver->observe($usage);
+ $pressureObserver->observe($pressure);
+});
+```
+
+## Use Cases
+
+### Business Metrics
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Meter;
+
+class PaymentService
+{
+ public function processPayment(Order $order): void
+ {
+ $this->gateway->charge($order->total);
+
+ Meter::counter('payments.revenue', 'usd', 'Total revenue')
+ ->add($order->total, ['plan' => $order->plan]);
+ }
+}
+
+class RegisterController
+{
+ public function store(Request $request)
+ {
+ $user = $this->userService->create($request->validated());
+
+ Meter::counter('users.signups', 'users')->add(1);
+
+ return response()->json($user, 201);
+ }
+}
+```
+
+### Performance Metrics
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Meter;
+
+public function fetchExternalData(string $endpoint): array
+{
+ $latency = Meter::histogram('external_api.latency_ms', 'ms', 'External API call duration');
+
+ $start = hrtime(true);
+ try {
+ return \Http::get($endpoint)->json();
+ } finally {
+ $durationMs = (hrtime(true) - $start) / 1e6;
+ $latency->record($durationMs, ['endpoint' => $endpoint]);
+ }
+}
+```
+
+### Resource Metrics
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Meter;
+
+Meter::observableGauge('redis.connected_clients', 'connections', 'Active Redis connections')
+ ->observe(function ($observer) {
+ $info = \Redis::connection()->client('info');
+ $observer->observe((int) ($info['connected_clients'] ?? 0));
+ });
+```
+
+## Temporality
+
+The OTLP exporter supports a preferred temporality (`Delta` vs `Cumulative`) for exported metrics. Set it via env:
+
+```bash
+OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=Delta
+```
+
+Leave it unset to use the SDK default.
+
+## Metric Naming Conventions
+
+Use dot-separated names for organization:
+
+```php
+// Good
+Meter::counter('orders.created');
+Meter::histogram('db.query_ms');
+Meter::counter('cache.hits');
+
+// Bad
+Meter::counter('created'); // Too vague
+Meter::counter('orderCount'); // Inconsistent style
+```
diff --git a/docs/pages/client/laravel/spans.mdx b/docs/pages/client/laravel/spans.mdx
new file mode 100644
index 00000000..46e7734a
--- /dev/null
+++ b/docs/pages/client/laravel/spans.mdx
@@ -0,0 +1,165 @@
+# Spans
+
+The package creates spans for HTTP requests, DB queries, queue jobs, cache calls, view renders, and outbound HTTP automatically. To measure sub-operations like business logic, third-party API calls, or batched work, create spans using the `Tracer` facade.
+
+## Using the `Tracer` Facade
+
+`keepsuit/laravel-opentelemetry` ships a `Tracer` facade. The standard pattern is to build a span with `newSpan('name')` and then call `measure(...)` (auto-activates the span, runs the callback, ends the span):
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Tracer;
+
+class OrderService
+{
+ public function processOrder(int $orderId): void
+ {
+ Tracer::newSpan('order.validate')->measure(function () use ($orderId) {
+ $this->validateOrder($orderId);
+ });
+
+ Tracer::newSpan('order.charge')->measure(function () use ($orderId) {
+ $this->chargePayment($orderId);
+ });
+ }
+}
+```
+
+`measure` returns the callback's return value, so you can capture results:
+
+```php
+$total = Tracer::newSpan('order.total')->measure(fn () => $this->calculateTotal());
+```
+
+> **Exception handling inside `measure`:** if the callback throws, `measure` calls `$span->recordException($e)` and rethrows. It does **not** call `setStatus(STATUS_ERROR)` — that means the exception event is attached to the span but the span's status code stays `UNSET`. Traceway's Issues feed still picks up the exception event, but if you want the span to be marked as failed in the trace view, set the status yourself:
+>
+> ```php
+> use OpenTelemetry\API\Trace\StatusCode;
+>
+> Tracer::newSpan('charge')->measure(function ($span) {
+> try {
+> $this->stripe->charge();
+> } catch (\Throwable $e) {
+> $span->setStatus(StatusCode::STATUS_ERROR, $e->getMessage());
+> throw $e;
+> }
+> });
+> ```
+>
+> Or if the exception goes through Laravel's exception handler (i.e., bubbles up out of `measure`), the package's auto-registered `reportable()` callback sets the status on the still-active span before `measure`'s `finally` ends it — so you usually don't need to do this manually.
+
+### With Attributes
+
+Set attributes on the active span inside your callback:
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Tracer;
+use OpenTelemetry\API\Trace\Span;
+
+$result = Tracer::newSpan('stripe.charge')->measure(function () use ($amount) {
+ Span::getCurrent()->setAttribute('payment.amount', $amount);
+ Span::getCurrent()->setAttribute('payment.currency', 'usd');
+
+ return $this->stripe->charge($amount);
+});
+```
+
+### Nested Spans
+
+Child spans created with `measure` are automatically activated, so any further spans nest under them:
+
+```php
+Tracer::newSpan('order.fulfill')->measure(function () {
+ Tracer::newSpan('inventory.reserve')->measure(fn () => $this->reserve());
+ Tracer::newSpan('payment.charge')->measure(fn () => $this->charge());
+ Tracer::newSpan('email.send')->measure(fn () => $this->notify());
+});
+```
+
+## Manual Span Management
+
+If you need finer control (e.g., spans that cross function boundaries), start and end the span yourself. You must call `activate()` to make it the parent for new spans, then `detach()` the scope when done:
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Tracer;
+
+$span = Tracer::newSpan('long-running-job')->start();
+$scope = $span->activate();
+
+try {
+ $this->doWork();
+} finally {
+ $scope->detach();
+ $span->end();
+}
+```
+
+Always end spans in a `finally` block so they are closed even if an exception is thrown.
+
+## Other Tracer Utilities
+
+The `Tracer` facade exposes a few helpers that come in handy when working with custom spans:
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Tracer;
+
+Tracer::traceId(); // the active trace id (string)
+Tracer::activeSpan(); // the currently-active SpanInterface
+Tracer::activeScope(); // the currently-active ScopeInterface
+Tracer::currentContext(); // the OTel Context object — for advanced use
+Tracer::propagationHeaders(); // headers to inject into outbound requests so downstream services join the trace
+Tracer::extractContextFromPropagationHeaders($headers); // build a Context from inbound headers
+Tracer::updateLogContext(); // inject the active trace id into Laravel's log context (only needed if you start the root span manually)
+```
+
+## Adding Attributes
+
+Attach metadata to spans for filtering and debugging:
+
+```php
+use OpenTelemetry\API\Trace\Span;
+
+$span = Tracer::newSpan('db-query')->start();
+$scope = $span->activate();
+try {
+ $span->setAttribute('db.system', 'mysql');
+ $span->setAttribute('db.statement', 'SELECT * FROM users WHERE id = ?');
+ $span->setAttribute('db.row_count', $rowCount);
+} finally {
+ $scope->detach();
+ $span->end();
+}
+```
+
+## Recording Errors on Spans
+
+When a span's operation fails, record the exception and set the status:
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Facades\Tracer;
+use OpenTelemetry\API\Trace\StatusCode;
+
+$span = Tracer::newSpan('external-api-call')->start();
+$scope = $span->activate();
+try {
+ $response = \Http::get('https://api.example.com/data');
+} catch (\Throwable $e) {
+ $span->recordException($e);
+ $span->setStatus(StatusCode::STATUS_ERROR, $e->getMessage());
+ throw $e;
+} finally {
+ $scope->detach();
+ $span->end();
+}
+```
+
+## Span Naming Conventions
+
+Use descriptive names that indicate the operation type:
+
+| Good | Bad |
+|------|-----|
+| `db.users.find` | `query` |
+| `cache.sessions.get` | `cache` |
+| `stripe.charge` | `api` |
+| `s3.upload-image` | `upload` |
+| `email.send-welcome` | `send` |
diff --git a/docs/pages/client/laravel/tasks.mdx b/docs/pages/client/laravel/tasks.mdx
new file mode 100644
index 00000000..78e722a1
--- /dev/null
+++ b/docs/pages/client/laravel/tasks.mdx
@@ -0,0 +1,159 @@
+# Tasks
+
+The `QueueInstrumentation` automatically traces Laravel queue jobs. When a job is dispatched, a `PRODUCER` span is created; when the worker picks it up, a `CONSUMER` span runs the handler. W3C trace context is propagated through the job payload so the consumer span links back to the dispatch trace — the full lifecycle is visible as one continuous trace in Traceway, and each consumed job appears as a **task** with duration, status, and any child spans.
+
+## Setup
+
+`QueueInstrumentation` is enabled by default. If it's not already in your `config/opentelemetry.php`:
+
+```php
+use Keepsuit\LaravelOpenTelemetry\Instrumentation;
+
+return [
+ 'instrumentation' => [
+ // ...
+ Instrumentation\QueueInstrumentation::class => env('OTEL_INSTRUMENTATION_QUEUE', true),
+ ],
+];
+```
+
+That's it — every queued job is now traced automatically. The same setup applies whether you use `database`, `redis`, `sqs`, or `beanstalkd` drivers.
+
+## What Gets Captured
+
+For each queued job the instrumentation creates two spans:
+
+- **Dispatch span** — name `send {queue}` (e.g., `send default`), `PRODUCER` kind, ended when Laravel finishes pushing the payload onto the queue.
+- **Process span** — name `process {queue}` (e.g., `process default`), `CONSUMER` kind, ended when the handler returns or fails. On `JobFailed` the span records the exception and is marked `STATUS_ERROR`.
+
+Both spans carry these attributes (using OTel messaging semantic conventions):
+
+| Attribute | Value |
+|---|---|
+| `messaging.system` | The queue driver — `redis`, `database`, `sqs`, `beanstalkd`, … |
+| `messaging.operation.type` | `send` (producer) or `process` (consumer) |
+| `messaging.message.id` | Laravel's job UUID |
+| `messaging.destination.name` | The queue name |
+| `messaging.message.envelope.size` | Payload size in bytes |
+| `messaging.message.job_name` | The job class name (e.g., `App\Jobs\SendOrderEmail`) |
+| `messaging.message.attempts` | Current attempt number |
+| `messaging.message.max_tries` / `max_exceptions` / `retry_until` / `timeout` | Job configuration |
+
+W3C trace context is also injected into the job payload, so the `process` span is linked to the trace where the job was originally dispatched — even if dispatch and execution happen on different services. Any spans you create inside `handle()` automatically nest under the `process` span.
+
+## Adding Attributes in Handlers
+
+Since the instrumentation activates the consumer span before your `handle()` runs, use `Span::getCurrent()` to add custom attributes:
+
+```php
+namespace App\Jobs;
+
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use OpenTelemetry\API\Trace\Span;
+
+class SendOrderEmail implements ShouldQueue
+{
+ use Queueable;
+
+ public function __construct(
+ public readonly int $orderId,
+ public readonly string $recipient,
+ ) {}
+
+ public function handle(): void
+ {
+ $span = Span::getCurrent();
+ $span->setAttribute('order.id', $this->orderId);
+ $span->setAttribute('email.to', $this->recipient);
+
+ // ... business logic ...
+ }
+}
+```
+
+## Child Spans in Handlers
+
+For jobs with distinct sub-operations, use the `Tracer` facade to create child spans. They automatically nest under the task's consumer span:
+
+```php
+namespace App\Jobs;
+
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Keepsuit\LaravelOpenTelemetry\Facades\Tracer;
+use OpenTelemetry\API\Trace\Span;
+
+class ProcessPayment implements ShouldQueue
+{
+ use Queueable;
+
+ public function __construct(
+ public readonly int $paymentId,
+ public readonly float $amount,
+ ) {}
+
+ public function handle(): void
+ {
+ Tracer::newSpan('validate.payment')->measure(function () {
+ Span::getCurrent()->setAttribute('payment.id', $this->paymentId);
+ $this->validate();
+ });
+
+ Tracer::newSpan('charge.gateway')->measure(function () {
+ Span::getCurrent()->setAttribute('payment.amount', $this->amount);
+ $this->chargeGateway();
+ });
+ }
+}
+```
+
+## Console Commands
+
+Console commands are **not traced by default** — only commands you opt-in are wrapped in a span. Add them to the `commands` array of `ConsoleInstrumentation`:
+
+```php
+// config/opentelemetry.php
+use Keepsuit\LaravelOpenTelemetry\Instrumentation;
+use App\Console\Commands\CleanupOrphans;
+
+return [
+ 'instrumentation' => [
+ // ...
+ Instrumentation\ConsoleInstrumentation::class => [
+ 'enabled' => env('OTEL_INSTRUMENTATION_CONSOLE', true),
+ 'commands' => [
+ // by class name
+ CleanupOrphans::class,
+ // or by signature
+ 'app:rebuild-search-index',
+ ],
+ ],
+ ],
+];
+```
+
+Each listed command is opened as a root span at start and ended on exit. Inside `handle()`, use `Span::getCurrent()` to add attributes:
+
+```php
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+use OpenTelemetry\API\Trace\Span;
+
+class CleanupOrphans extends Command
+{
+ protected $signature = 'cleanup:orphans';
+
+ public function handle(): int
+ {
+ Span::getCurrent()->setAttribute('cleanup.dry_run', false);
+
+ // ... do work ...
+
+ return self::SUCCESS;
+ }
+}
+```
+
+Unlisted commands run without a span, so `Span::getCurrent()` inside them returns a no-op span — attribute and event calls are silently dropped, which is safe but not useful.
diff --git a/docs/pages/client/otel/index.mdx b/docs/pages/client/otel/index.mdx
index 34441ba4..eb1a8080 100644
--- a/docs/pages/client/otel/index.mdx
+++ b/docs/pages/client/otel/index.mdx
@@ -22,6 +22,7 @@ Any language with an OTel SDK can export to Traceway. Here are the most common o
| Go | [opentelemetry-go](https://github.com/open-telemetry/opentelemetry-go) | `go get go.opentelemetry.io/otel` |
| Node.js | [opentelemetry-js](https://github.com/open-telemetry/opentelemetry-js) | `npm install @opentelemetry/sdk-node` — see [Node.js guide](/client/node-sdk), [NestJS guide](/client/nestjs), [Hono guide](/client/hono), [Next.js guide](/client/nextjs) |
| PHP / Symfony | [opentelemetry-php](https://github.com/open-telemetry/opentelemetry-php) | `composer require open-telemetry/sdk` — see [Symfony guide](/client/symfony) |
+| PHP / Laravel | [opentelemetry-php](https://github.com/open-telemetry/opentelemetry-php) | `composer require keepsuit/laravel-opentelemetry` — see [Laravel guide](/client/laravel) |
| Cloudflare Workers | [workers-sdk](https://developers.cloudflare.com/workers/observability/otel/) | Built-in — see [Cloudflare guide](/client/otel-cloudflare) |
## Configuration
diff --git a/docs/public/laravel.png b/docs/public/laravel.png
new file mode 100644
index 00000000..994dd33c
Binary files /dev/null and b/docs/public/laravel.png differ
diff --git a/frontend/src/lib/components/framework-combobox.svelte b/frontend/src/lib/components/framework-combobox.svelte
index dd58a117..1255ecdc 100644
--- a/frontend/src/lib/components/framework-combobox.svelte
+++ b/frontend/src/lib/components/framework-combobox.svelte
@@ -33,6 +33,7 @@
{ value: 'vuejs', label: 'Vue.js', description: 'Progressive frontend framework', group: 'JavaScript' },
{ value: 'jquery', label: 'jQuery', description: 'Legacy-friendly AJAX and DOM library', group: 'JavaScript' },
{ value: 'symfony', label: 'Symfony', description: 'PHP full-stack framework (OTLP)', group: 'PHP' },
+ { value: 'laravel', label: 'Laravel', description: 'PHP full-stack framework (OTLP)', group: 'PHP' },
{ value: 'hono', label: 'Hono', description: 'Lightweight multi-runtime framework (OTLP)', group: 'Backend' },
{ value: 'cloudflare', label: 'Cloudflare', description: 'Cloudflare Workers (OTLP Traces)', group: 'Backend' },
{ value: 'opentelemetry', label: 'OpenTelemetry', description: 'Vendor-neutral observability', group: 'Backend' },
diff --git a/frontend/src/lib/components/framework-icon.svelte b/frontend/src/lib/components/framework-icon.svelte
index b31a32cc..29c3c19b 100644
--- a/frontend/src/lib/components/framework-icon.svelte
+++ b/frontend/src/lib/components/framework-icon.svelte
@@ -56,6 +56,8 @@
<img src="/opentelemetry.png" alt="OpenTelemetry" class={className} />
{:else if framework === 'symfony'}
<img src="/symfony.png" alt="Symfony" class={className} />
+{:else if framework === 'laravel'}
+ <img src="/laravel.png" alt="Laravel" class={className} />
{:else if framework === 'flutter'}
<img src="/flutter.png" alt="Flutter" class={className} style="object-fit: contain;" />
{:else if framework === 'android'}
diff --git a/frontend/src/lib/state/projects.svelte.ts b/frontend/src/lib/state/projects.svelte.ts
index 939463b9..1a753331 100644
--- a/frontend/src/lib/state/projects.svelte.ts
+++ b/frontend/src/lib/state/projects.svelte.ts
@@ -1,7 +1,7 @@
import { api } from '$lib/api';
import { authState } from './auth.svelte';
-export type Framework = 'gin' | 'fiber' | 'chi' | 'fasthttp' | 'stdlib' | 'custom' | 'react' | 'svelte' | 'vuejs' | 'nextjs' | 'nestjs' | 'express' | 'remix' | 'jquery' | 'react-native' | 'hono' | 'cloudflare' | 'opentelemetry' | 'symfony' | 'flutter' | 'android';
+export type Framework = 'gin' | 'fiber' | 'chi' | 'fasthttp' | 'stdlib' | 'custom' | 'react' | 'svelte' | 'vuejs' | 'nextjs' | 'nestjs' | 'express' | 'remix' | 'jquery' | 'react-native' | 'hono' | 'cloudflare' | 'opentelemetry' | 'symfony' | 'laravel' | 'flutter' | 'android';
export const FRONTEND_FRAMEWORKS: Framework[] = ['react', 'svelte', 'vuejs', 'jquery', 'react-native', 'flutter', 'android'];
export const JS_FRAMEWORKS: Framework[] = ['react', 'svelte', 'vuejs', 'nextjs', 'nestjs', 'express', 'remix', 'jquery', 'react-native'];
@@ -26,6 +26,7 @@ export const FRAMEWORK_LABELS: Record<Framework, string> = {
cloudflare: 'Cloudflare',
opentelemetry: 'OpenTelemetry',
symfony: 'Symfony',
+ laravel: 'Laravel',
flutter: 'Flutter',
android: 'Android',
};
diff --git a/frontend/src/lib/utils/framework-code.ts b/frontend/src/lib/utils/framework-code.ts
index 87f05bcc..2b54159a 100644
--- a/frontend/src/lib/utils/framework-code.ts
+++ b/frontend/src/lib/utils/framework-code.ts
@@ -36,6 +36,8 @@ export function getInstallCommand(framework: Framework): string {
return '';
case 'symfony':
return 'composer require traceway/opentelemetry-symfony open-telemetry/exporter-otlp php-http/guzzle7-adapter';
+ case 'laravel':
+ return 'composer require keepsuit/laravel-opentelemetry open-telemetry/exporter-otlp php-http/guzzle7-adapter';
case 'cloudflare':
return '';
case 'opentelemetry':
@@ -316,6 +318,27 @@ $response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);`;
+ case 'laravel':
+ return `<?php
+// .env — point the OTLP exporter at Traceway
+//
+// OTEL_SERVICE_NAME=my-laravel-app
+// OTEL_TRACES_EXPORTER=otlp
+// OTEL_METRICS_EXPORTER=otlp
+// OTEL_LOGS_EXPORTER=otlp
+// OTEL_EXPORTER_OTLP_PROTOCOL=http/json
+// OTEL_EXPORTER_OTLP_ENDPOINT=${backendUrl}/api/otel
+// OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer ${token || 'YOUR_TOKEN'}"
+//
+// Optional: send Laravel logs to Traceway via the auto-injected 'otlp' channel
+// LOG_CHANNEL=otlp
+
+// That's it — keepsuit/laravel-opentelemetry's service provider auto-registers
+// TraceRequestMiddleware as a global middleware, so every HTTP request, DB query,
+// queued job, Redis call, cache op, view render and outbound Http:: call is
+// traced automatically. Open config/opentelemetry.php to tune which
+// instrumentations are enabled.`;
+
case 'hono':
return '';
@@ -391,6 +414,15 @@ class TestController
throw new \\RuntimeException("Test error from Traceway integration");
}
}`;
+ }
+ if (framework === 'laravel') {
+ return `<?php
+// routes/web.php
+use Illuminate\\Support\\Facades\\Route;
+
+Route::get('/testing', function () {
+ throw new \\RuntimeException('Test error from Traceway integration');
+});`;
}
if (framework === 'flutter') {
return `// Trigger a test error
@@ -413,6 +445,9 @@ export function getTestingRouteCode2(framework?: Framework): string {
if (framework === 'symfony') {
return '';
}
+ if (framework === 'laravel') {
+ return '';
+ }
if (framework === 'flutter') {
return `import 'package:traceway/traceway.dart';
@@ -512,6 +547,7 @@ export function getFrameworkLabel(framework: Framework): string {
cloudflare: 'Cloudflare',
opentelemetry: 'OpenTelemetry',
symfony: 'Symfony',
+ laravel: 'Laravel',
flutter: 'Flutter',
android: 'Android',
};
@@ -520,6 +556,7 @@ export function getFrameworkLabel(framework: Framework): string {
export function getCodeLanguage(framework: Framework): 'go' | 'javascript' | 'bash' | 'php' {
if (framework === 'symfony') return 'php';
+ if (framework === 'laravel') return 'php';
if (framework === 'opentelemetry') return 'go';
if (framework === 'hono') return 'javascript';
if (framework === 'cloudflare') return 'javascript';
diff --git a/frontend/src/routes/connection/+page.svelte b/frontend/src/routes/connection/+page.svelte
index 7e32b3c1..53a3b37d 100644
--- a/frontend/src/routes/connection/+page.svelte
+++ b/frontend/src/routes/connection/+page.svelte
@@ -108,6 +108,7 @@ service:
const highlightLanguage = $derived.by(() => {
if (!projectWithToken) return go;
if (projectWithToken.framework === 'symfony') return php;
+ if (projectWithToken.framework === 'laravel') return php;
if (isJsFramework(projectWithToken.framework)) return javascript;
return go;
});
@@ -414,7 +415,7 @@ service:
<CardHeader>
<CardTitle>Installation</CardTitle>
<CardDescription
- >Install the required packages{isJs ? '' : projectWithToken?.framework === 'symfony' ? ' using composer' : ' using go get'}.</CardDescription
+ >Install the required packages{isJs ? '' : projectWithToken?.framework === 'symfony' || projectWithToken?.framework === 'laravel' ? ' using composer' : ' using go get'}.</CardDescription
>
</CardHeader>
<CardContent>
diff --git a/frontend/static/laravel.png b/frontend/static/laravel.png
new file mode 100644
index 00000000..994dd33c
Binary files /dev/null and b/frontend/static/laravel.png differ