2017 © Pedro Peláez
 

library newrelic-api

A simple php wrapper for new relics api

image

kevbaldwyn/newrelic-api

A simple php wrapper for new relics api

  • Tuesday, April 14, 2015
  • by kevbaldwyn
  • Repository
  • 1 Watchers
  • 0 Stars
  • 77 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

newrelic-api

Simple php wrapper for the New Relic api, based on https://gist.github.com/HarryR/3177007, (*1)

Installation

With Composer, (*2)

"require": {
    ...
    "kevbaldwyn/newrelic-api": "dev-master"
    ...
}

Composer Update:, (*3)

$ composer update kevbaldwyn/newrelic-api

Usage

Instantiate the ApiClient with your credentials:, (*4)

use KevBaldwyn\NewRelicApi\ApiClient;

$api = new ApiClient('api-key', 'account-id');

Create a request object and call it:, (*5)

// in this case send a deployment
$req = $api->sendDeployment('app-id', 'User Name', 'Description', 'Change log', 'version');
$api->call($req);

The call method returns an instance of GuzzleHttp\Message\Response so that can be interrogated to get the response data ie:, (*6)

$res = $api->call($req);

// check response code
if($res->getStatusCode() == 200) {
    $xml = $res->xml();
}

Available wrapper methods

  • getApplications()
  • getSummary()
  • listMetrics()
  • getData()
  • sendDeployment()

Other calls can be made by manually building a request using buildRequest and then calling it ie:, (*7)

$req = $api->buildRequest($endpoint, $method, $data);
$api->call($req);

The Versions

14/04 2015

dev-master

9999999-dev

A simple php wrapper for new relics api

  Sources   Download

The Requires

 

The Development Requires