blueweb/newrelic-nette

New Relic integration into Nette Framework

Maintainers

Package info

github.com/blueweb/newrelic-nette

pkg:composer/blueweb/newrelic-nette

Transparency log

Statistics

Installs: 54 919

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

4.1.0 2026-08-21 14:04 UTC

This package is auto-updated.

Last update: 2026-08-21 14:08:50 UTC


README

Repository https://github.com/blueweb/newrelic-nette.

Requirements

Library blueweb/newrelic-nette requires PHP 7.4 or higher.

Installation

The best way to install blueweb/newrelic-nette is using Composer:

$ composer require blueweb/newrelic-nette

You have to also add this to your config.neon:

extensions:
	newrelic: Blueweb\NewRelic\DI\DiExtension

Extension is automatically disabled in development environment. You can also manually enable/disable the extension:

newrelic:
	enable: false

enable covers transaction naming and error reporting. The features below are configured independently of it.

Custom parameters

Blueweb\NewRelic\NewRelic is registered as an autowired service and is the way to put custom parameters on the current transaction:

public function __construct(private NewRelic $newRelic) {}

$this->newRelic->addParameter('order.id', $orderId);
$this->newRelic->addParameters(['cart.items' => 3, 'cart.total' => 129.9]);

Parameters are sent right away. They are kept in memory as well, so the service also works without the newrelic extension - nothing is sent, but the values can still be inspected (see the Tracy panel below).

For values known only at the end of the transaction there is a provider, which is evaluated in register_shutdown_function(), i.e. while the transaction is still open:

$this->newRelic->addProvider(fn (): array => ['queue.jobs' => $this->count]);

Query statistics

When dibi/dibi is installed and a Dibi\Connection service exists, queries are counted automatically and sent as db.queryCount, db.queryTime (ms), db.select, db.insert, db.update, db.delete, db.transaction, db.connect and db.other.

newrelic:
	queryStats: true

Note that listening on Dibi\Connection::$onEvent makes dibi build a Dibi\Event for every query, including a debug_backtrace() call - a small but non-zero cost per query. Turn the statistics off with queryStats: false.

Tracy panel

In development a bar panel lists all custom parameters that would be sent to New Relic, together with the information whether the extension is loaded at all. It renders the deferred provider values too.

newrelic:
	panel: %debugMode%