dev-master
9999999-devA simple php wrapper for new relics api
The Requires
- php >=5.4
- guzzlehttp/guzzle ~5.0
The Development Requires
Wallogit.com
2017 © Pedro Peláez
A simple php wrapper for new relics api
Simple php wrapper for the New Relic api, based on https://gist.github.com/HarryR/3177007, (*1)
With Composer, (*2)
"require": {
...
"kevbaldwyn/newrelic-api": "dev-master"
...
}
Composer Update:, (*3)
$ composer update kevbaldwyn/newrelic-api
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();
}
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);
A simple php wrapper for new relics api