Symfony/Laravel Compatibility: The package is a Symfony bundle (originally ekino/newrelic-bundle), but Laravel’s ecosystem differs significantly from Symfony’s. While Laravel shares some Symfony components (e.g., routing, service containers), this bundle’s Symfony-specific abstractions (e.g., Bundle, EventDispatcher, Kernel) make direct integration non-trivial.
AppServiceProvider) instead of Symfony bundles.Illuminate\Http\Request) differs from Symfony’s HttpFoundation.Artisan) is not directly compatible with Symfony’s Console component.EventDispatcher with Laravel’s Events system.Route::current()) and controllers.New Relic PHP Agent Compatibility:
EkinoNewRelicBundle\NewRelic\TransactionNamer\RouteTransactionNamer with a Laravel RouteServiceProvider listener.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony Abstraction Leak | High | Abstract bundle logic into Laravel-compatible interfaces. |
| Transaction Naming Inconsistencies | Medium | Implement a fallback to Laravel’s Route::current() and request()->route(). |
| Console Command Tracking | Medium | Override Laravel’s Artisan kernel to inject New Relic context. |
| Performance Overhead | Low | Benchmark against native New Relic agent. |
| Maintenance Burden | High | Fork the bundle and maintain it long-term. |
newrelic/laravel packages).spatie/laravel-newrelic or custom middleware.Artisan lacks Symfony’s CommandEvent, requiring a custom solution.Laravel Compatibility Matrix:
| Laravel Feature | Bundle Feature | Integration Path |
|---|---|---|
Routing (Route::current()) |
Route-based transaction naming | Replace RouteTransactionNamer with a Laravel service. |
| Service Container | Bundle services | Register as Laravel providers. |
Events (Events::dispatch()) |
Symfony events | Map to Laravel’s Event facade. |
| Artisan Commands | Console command tracking | Override Artisan kernel or use middleware. |
| Middleware | HTTP request instrumentation | Use Laravel’s Handle middleware. |
Recommended Stack:
TransactionNamerInterface).EventDispatcher.Phase 1: Basic APM (0-2 weeks)
newrelic/newrelic-php agent.newrelic.ini for Laravel.Phase 2: Port Bundle Features (2-4 weeks)
RouteTransactionNamer with a Laravel RouteServiceProvider listener.// app/Providers/RouteServiceProvider.php
public function boot()
{
$this->app->booted(function () {
$request = app('request');
if ($request->route()) {
newrelic_name_transaction('Route: ' . $request->route()->getName());
}
});
}
Artisan::kernel() or use middleware to set transaction names.// app/Providers/AppServiceProvider.php
public function boot()
{
Artisan::starting(function ($event) {
newrelic_name_transaction('Command: ' . $event->commandName);
});
}
kernel.request) to Laravel’s Events::dispatch('kernel.request').Phase 3: Testing & Optimization (1-2 weeks)
NewRelic\Agent to test transaction naming.Symfony/HTTPFoundation if needed (e.g., for Route matching).TransactionNamer bug could manifest as incorrect route names in New Relic.newrelic -v).newrelic_* errors.| Issue Type | Support Path |
|---|---|
| New Relic Agent | New Relic PHP docs / GitHub |
| Laravel Integration | Internal team (no upstream support) |
| Symfony Abstraction Leak | Custom debugging |
How can I help you explore Laravel packages today?