Download the PHP package roenschg/php-newrelic without Composer
On this page you can find all versions of the php package roenschg/php-newrelic. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download roenschg/php-newrelic
More information about roenschg/php-newrelic
Files in roenschg/php-newrelic
Package php-newrelic
Short Description Wrapper for the NewRelic Agent API that allows to send big amounts of custom events reliably.
License MIT
Informations about the package php-newrelic
php-newrelic
This package provides a simple and clean wrapper around the newrelic APM agent API and also enables you to send large amounts of custom metrics into newrelic without dropping any data.
Installation
Basic Usage
You have one class that acts as a wrapper for every function that the PHP agent api defines.
Crossed fingers (Instead of using extension_loaded('newrelic'))
The CrossedFingers
handler allows you to use the same methods on environments without a NewRelic extension installed
without throwing errors. So instead of doing this if on every line where you want to send events to:
If the extension does not exist, nothing will be done.
HTTP Bulk sending (Send huge amounts of custom events reliable)
If you need to make sure that you send all the data to NewRelic even if you reach the limits
of the agent you can use the CustomEventHandler AutoBulkHttp
.
Please note that this means you application will be slowed down by the amount of requests you send to NewRelic because of the logged custom events.
The following code shows you how to setup the NewRelicHandler to send the CustomEvents over the API and automaticly pack requests together in bulks.
The NewRelicHttpInsertApi
is responsible to connect to the InsightAPI and the NewRelicCustomEventBulkHttpHandler
is responsible to pack custom events together in bulk and is aware of the API limitations.
If the package is big enough it will flush the buffer and send the request to the insights api. The Buffer will be cleared during shutdown of you application as well.
If the data you pass to the method ecordCustomEvent
is invalid or to big, you will get an Exception.
List of methods
For further information about the methods please see the NewRelic documentation
- recordCustomEvent(...)
- addCustomParameter(...)
- backgroundJob(...)
- captureParams(...)
- customMetric(...)
- disableAutorum(...)
- endOfTransaction(...)
- endTransaction(...)
- ignoreApdex(...)
- ignoreTransaction(...)
- nameTransaction(...)
- noticeError(...)
- recordDatastoreSegment(...)
- setAppname(...)
- setUserAttributes(...)
- startTransaction(...)
- getTransactionHandler(...)
- setTransactionHandler(...)
Running Unit-Tests
Running Code-Sniffer
All versions of php-newrelic with dependencies
ext-curl Version *