kevbaldwyn / newrelic-api
A simple php wrapper for new relics api
Installs: 83
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/kevbaldwyn/newrelic-api
Requires
- php: >=5.4
- guzzlehttp/guzzle: ~5.0
Requires (Dev)
- mockery/mockery: dev-master
- phpunit/phpunit: 4.*
This package is not auto-updated.
Last update: 2025-10-11 21:54:01 UTC
README
Simple php wrapper for the New Relic api, based on https://gist.github.com/HarryR/3177007
##Installation With Composer
"require": {
...
"kevbaldwyn/newrelic-api": "dev-master"
...
}
Composer Update:
$ composer update kevbaldwyn/newrelic-api
##Usage
Instantiate the ApiClient
with your credentials:
use KevBaldwyn\NewRelicApi\ApiClient;
$api = new ApiClient('api-key', 'account-id');
Create a request object and call it:
// 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:
$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:
$req = $api->buildRequest($endpoint, $method, $data);
$api->call($req);