webgriffe/newrelic-bundle
Symfony bundle that integrates the New Relic PHP agent, automatically naming transactions after routes and reporting exceptions, custom metrics, and deployment markers so you can monitor performance and errors in New Relic APM.
Architecture fit. Low for a Laravel codebase. Despite the "Laravel/PHP package" framing, this is a Symfony2 bundle (EkinoNewRelicBundle, forked by Webgriffe). Its structure is bundle-native: a Bundle subclass, a DependencyInjection extension with a Configuration tree, compiler passes, and a set of event subscribers (kernel.request, kernel.exception, kernel.console.*, Doctrine, Twig, Guzzle). None of that maps onto Laravel's ServiceProvider / middleware / event dispatcher model. Critically, the durable value is not the framework glue — it is roughly a dozen calls into the New Relic PHP agent (newrelic_name_transaction, newrelic_add_custom_parameter, newrelic_add_custom_tracer, newrelic_notice_error, newrelic_set_appname). Those are one-liners; ~80% of the package is Symfony2 wiring that would be discarded on a Laravel port.
Integration feasibility. Composer-installable in principle, not in practice. Expect hard constraints on symfony/symfony in the 2.x range, likely old Guzzle and sensio/framework-extra-bundle transitive requirements. composer require into a modern Laravel app will either fail resolution or pin dependencies we do not want. Realistic path is fork-and-rewrite, not consume-as-is.
Technical risk: high.
newrelic_* functions. If the PHP extension is absent, unguarded calls fatal the request — a package-level outage vector in dev/CI or on a host where the agent was missed.Key questions for the vendor/platform team.
ekino/EkinoNewRelicBundle with internal patches, or an untouched mirror? If untouched, the upstream project status is the real answer.Recommendation. Treat this as a reference implementation, not a dependency. Harvest its transaction-naming conventions and listener coverage, then implement a thin in-house Laravel package or rely on native agent instrumentation. Adopting a zero-adoption Symfony2 bundle into a Laravel stack imports maintenance liability with no offsetting benefit.
Stack fit. Poor by construction. Laravel's HTTP kernel, container bindings, exception handler, queue worker, and console kernel each need a different hook than the Symfony equivalents this package targets. Reusing the code is a rewrite with the original as a spec.
Migration path. Recommended sequence for porting the ideas rather than the code:
newrelic_notice_error.Illuminate\Contracts\Debug\ExceptionHandler for error reporting, Queue::before/after and JobProcessing/JobProcessed events for background transactions, Artisan::starting / command events for CLI, HTTP client middleware for outbound calls.function_exists() guards so absence of the extension degrades to a no-op rather than a 500.Compatibility. The New Relic PHP agent function surface is stable and long-lived; the risk is the package's PHP/Symfony constraints, not the agent API. If the estate is mid-migration from Symfony to Laravel, matching transaction naming conventions matters — otherwise dashboards and alert policies split into two unrelated app names during the cutover.
Sequencing.
Do not attempt a dual-run where the bundle exists in a Laravel app "for reference." Dead code in a dependency tree still gets scanned, patched, and audited.
Maintenance. The package is unmaintained; adopting it means we own the fork outright. Estimate one to two engineer-weeks for an initial Laravel port and roughly 0.1 FTE per quarter thereafter for agent upgrades, PHP version bumps, and Laravel major-version compatibility — a real cost against a ~50-line-per-concern internal package that would need less.
Support. No upstream to escalate to, no vendor SLA, no CVE feed. MIT license at least permits forking and internal redistribution. If something breaks during an incident, the on-call engineer debugs agent internals alone.
Scaling. Agent-side overhead is modest and largely off the request path, but two scaling concerns are real: (a) transaction-name cardinality — naming transactions on raw route templates with IDs, query strings, or job payloads explodes the metric namespace and inflates New Relic ingest cost; (b) custom parameters and custom metrics count against per-host data limits and can hit licensing ceilings in high-throughput services. Enforce a naming convention in code review, not in configuration.
Failure modes to design against.
newrelic_* call → fatal error in dev, CI, or a host missed by provisioning.Ramp-up. Low for the agent API itself (an afternoon for anyone who has read the New Relic PHP docs); medium for the bundle's listener topology and configuration tree; low for the Laravel replacement. A Laravel engineer can reproduce the useful 20% of this package in two to three days. A Symfony engineer can read the original in an hour but gains nothing transferable to a Laravel target beyond naming conventions. Net: the ramp-up cost exceeds the value of the dependency, which reinforces the reference-implementation approach.
How can I help you explore Laravel packages today?