Download the PHP package tiime/newrelic-bundle without Composer

On this page you can find all versions of the php package tiime/newrelic-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package newrelic-bundle

[!IMPORTANT] This bundle have been originally created by Ekino and can be found here. Due to lack of maintenance, we decided to fork it and here is the result.

Tiime NewRelic Bundle

This bundle integrates the NewRelic PHP API into Symfony. For more information about NewRelic, please visit http://newrelic.com. The built-in New Relic agent doesn't add as much Symfony integration as it claims. This bundle adds a lot more essentials. Here's a quick list:

  1. Better transaction naming strategy: Your transaction traces can be named accurately by route names, the controller name or you can decide on a custom naming strategy via a seamless interface that uses any naming convention you deem fit. While running console commands, it also sets the transaction name as the command name.

  2. Console Commands Enhancements: While running console commands, its sets the options and arguments passed via the CLI as custom parameters to the transaction trace for easier debugging.

  3. Exception Listening: It also captures all Symfony exceptions in web requests and console commands and sends them to New Relic (something new relic doesn't do too well itself as symfony aggressively catches all exceptions/errors). It also ensures all HTTP Exceptions (4xx codes) are logged as notices in New Relic and not exceptions to reduce the noise in New Relic.

  4. Interactor Service: It provides you the New Relic PHP Agent API via a Service class NewRelicInteractorInterface::class so in my code, I can inject it into any class, controller, service and do stuff like -

  5. Logging Support: In development, you are unlikely to have New Relic setup. There's a configuration to enable logging which outputs all New Relic actions to your Symfony log, hence emulating what it would actually do in production.

  6. Ignored Routes, Paths, Commands: You can configure a list of route name, url paths and console commands to be ignored from New Relic traces.

    image

  7. Misc: There are other useful configuration like your New Relic API Key, explicitly defining your app name instead of php.ini, notifying New Relic about new deployments via capifony, etc.

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

Configure the bundle

In New Relic's web interface, make sure to get a valid (REST) API Key, not to be confused with your License key : New Relic Dashboard > Account settings > Integration > API Keys

Enhanced RUM instrumentation

The bundle comes with an option for enhanced real user monitoring. Ordinarily the New Relic extension (unless disabled by configuration) automatically adds a tracking code for RUM instrumentation to all HTML responses. Using enhanced RUM instrumentation, the bundle allows you to selectively disable instrumentation on certain requests.

This can be useful if, e.g. you're returning HTML verbatim for an HTML editor.

If enhanced RUM instrumentation is enabled, you can disable instrumentation for a given request by passing along a _instrument request parameter, and setting it to false. This can be done e.g. through the routing configuration.

Transaction naming strategies

The bundle comes with two built-in transaction naming strategies. route and controller, naming the New Relic transaction after the route or controller respectively. However, the bundle supports custom transaction naming strategies through the service configuration option. If you have selected the service configuration option, you must pass the name of your own transaction naming service as the transaction_naming_service configuration option.

The transaction naming service class must implement the Tiime\NewRelicBundle\TransactionNamingStrategy\TransactionNamingStrategyInterface interface. For more information on creating your own services, see the Symfony documentation on Creating/Configuring Services in the Container.

Symfony HTTP Cache

When you are using Symfony's HTTP cache your app/AppCache.php will build up a response with your Edge Side Includes (ESI). This will look like one transaction in New Relic. When you set using_symfony_cache: true will these ESI request be separate transaction which improves the statistics. If you are using some other reverse proxy cache or no cache at all, leave this to false.

If true is required to set the application_name.

Deployment notification

You can use the newrelic:notify-deployment command to send deployment notifications to New Relic. This requires the api_key configuration to be set.

The command has a bunch of options, as displayed in the help data.

Interactor services

The config key tiime_new_relic.interactor will accept a service ID to a service implementing NewRelicInteractorInterface. This bundle comes with a few services that may be suitable for you.

Configuration value Description
Tiime\NewRelicBundle\NewRelic\AdaptiveInteractor This is the default interactor. It will check once per request if the NewRelic PHP extension is installed or not. It is a decorator for the NewRelicInteractor
Tiime\NewRelicBundle\NewRelic\NewRelicInteractor This interactor communicates with NewRelic. It is the one decorator that actually does some work.
Tiime\NewRelicBundle\NewRelic\BlackholeInteractor This interactor does nothing.
auto This value will check if the NewRelic PHP extension is installed when you build your container.

Note that if you set tiime_new_relic.enabled: false you will always use the BlackholeInteractor no matter what value used for tiime_new_relic.interactor.

Flow of the Request

  1. A request comes in and the first thing we do is to setApplicationName so that we use the correct license key and name.
  2. The RouterListener might throw a 404 or add routing values to the request.
  3. If no 404 was thrown we setIgnoreTransaction which means that we call NewRelicInteractorInterface::ignoreTransaction() if we have configured to ignore the route.
  4. The Firewall is the next interesting thing that will happen. It could change the controller or throw a 403.
  5. The developer might have configured many more request listeners that will now execute and possibly add stuff to the request.
  6. We will execute setTransactionName to use our TransactionNamingStrategyInterface to set a nice name.

All 6 steps will be executed for a normal request. Exceptions to this is 404 and 403 responses that will be created in step 2 and step 4 respectively. If an exception to these step occurs (I'm not talking about \Exception) you will have the transaction logged with the correct license key but you do not have the proper transaction name. The setTransactionName may have dependencies on data set by other listeners that is why it has such low priority.


All versions of newrelic-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
symfony/config Version ^5.4|^6.4|^7.0
symfony/console Version ^5.4|^6.4|^7.0
symfony/dependency-injection Version ^5.4|^6.4|^7.0
symfony/event-dispatcher Version ^5.4|^6.4|^7.0
symfony/http-kernel Version ^5.4|^6.4|^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tiime/newrelic-bundle contains the following files

Loading the files please wait ....