Skip to content

feat: Laravel integration — auto error/log capture, middleware, service provider#6

Open
CelebrityPunks wants to merge 1 commit intohighlight:mainfrom
CelebrityPunks:feat/laravel-integration
Open

feat: Laravel integration — auto error/log capture, middleware, service provider#6
CelebrityPunks wants to merge 1 commit intohighlight:mainfrom
CelebrityPunks:feat/laravel-integration

Conversation

@CelebrityPunks
Copy link
Copy Markdown

Summary

Adds deep Laravel integration to the Highlight PHP SDK for automatic error capture, log forwarding, and request tracing.

New Files

File Purpose
src/SDK/Laravel/HighlightServiceProvider.php Auto-registration via package discovery, publishes config, initializes SDK
src/SDK/Laravel/HighlightExceptionHandler.php Decorator pattern — auto-reports all exceptions to Highlight
src/SDK/Laravel/HighlightLogHandler.php Monolog handler — forwards Log:: calls as structured log events
src/SDK/Laravel/HighlightMiddleware.php Request-level tracing spans with session linking
config/highlight.php Laravel config with all options documented

Features

  • Zero-config setup via Laravel package auto-discovery
  • X-Highlight-Request header parsing for frontend session linking
  • Severity mapping from Monolog levels to OpenTelemetry
  • Non-blocking — exceptions are re-thrown after reporting

Usage

// config/highlight.php (auto-published)
return ['project_id' => env('HIGHLIGHT_PROJECT_ID')];

// app/Http/Kernel.php
protected $middleware = [\Highlight\SDK\Laravel\HighlightMiddleware::class];

Closes highlight/highlight#4225

🤖 Generated with Claude Code

Adds deep Laravel integration for automatic error/log capture:

- HighlightServiceProvider: auto-registration via package discovery,
  publishes config, initializes SDK on boot
- HighlightExceptionHandler: decorator that auto-reports all exceptions
  with X-Highlight-Request header parsing for session linking
- HighlightLogHandler: Monolog handler forwarding Laravel Log:: calls
  as structured log events with severity mapping
- HighlightMiddleware: request-level tracing with span-per-request
- config/highlight.php: Laravel config with all options documented

Closes highlight/highlight#4225

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support PHP (Laravel+Symphony) among our SDKs

2 participants