1. Go to this page and download the library: Download roenschg/php-newrelic library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
roenschg / php-newrelic example snippets
$newRelic = new Groensch\NewRelic\Handler(new Groensch\NewRelic\CustomEventHandler\PHPAgent());
$newRelic->nameTransaction('MyCustomTransactionName');
$newRelic->recordCustomEvent('eventName', ['count' => 20]);
if (extension_loaded('newrelic')) { // Ensure PHP agent is available
newrelic_name_transaction("/Product/view/");
}
$newRelic = new Groensch\NewRelic\Handler(
new \Groensch\NewRelic\CustomEventHandler\CrossedFingers(),
new \Groensch\NewRelic\TransactionHandler\CrossedFingers()
);
$newRelic->nameTransaction('MyCustomTransactionName');
$newRelic->recordCustomEvent('eventName', ['count' => 20]);
use Groensch\NewRelic\Handler as NewRelicHandler;
use Groensch\NewRelic\HttpInsertApi as NewRelicHttpInsertApi;
use Groensch\NewRelic\CustomEventHandler\AutoBulkHttp as NewRelicCustomEventBulkHttpHandler;
// Configure NewRelic handler
$newRelicHttpApi = new NewRelicHttpInsertApi(NEW_RELIC_API_ACCOUNT_ID, NEW_RELIC_API_INSERT_KEY);
$newRelicCustomEventHandler = new NewRelicCustomEventBulkHttpHandler($newRelicHttpApi);
$newRelic = new NewRelicHandler($newRelicCustomEventHandler);
// Record custom event
$newRelic->recordCustomEvent('test1', ['recorded' => (string) time()]);
$newRelic->recordCustomEvent('test2', ['recorded' => (string) time()]);
composer
shell
docker-compose run php composer install
docker-compose run php vendor/bin/phpunit
shell
docker-compose run php composer install
docker-compose run php vendor/bin/phpcs --config-set installed_paths vendor/escapestudios/symfony2-coding-standard
docker-compose run php vendor/bin/phpcs
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.