PHP implementation of Aino.io logging agent
What is Aino.io and what does this Agent have to do with it?
Aino.io is an analytics and monitoring tool for integrated enterprise applications and digital business processes. Aino.io can help organizations manage, develop, and run the digital parts of their day-to-day business. Read more from our web pages.
Aino.io works by analyzing transactions between enterprise applications and other pieces of software. This Agent helps to store data about the transactions to Aino.io platform using Aino.io Data API (version 2.0). See API documentation for detailed information about the API.
- PHP 5
Download the latest release
Import aino.io.loader.php
in your PHP file:
require_once('/path/to/aino.io/agent/root/dir/vendor/aino.io.loader.php');
use io\aino\Agent;
$agent = new Agent($apiKey);
$from = 'Web shop';
$to = 'DB';
$status = 'success'; //success or failure or unknown
$result = $agent->logTransaction($from,
$to,
$status);
$agent = new Agent($apiKey);
$from = 'Web shop';
$to = 'DB';
$status = 'success'; //success or failure or unknown
$message = 'Update users to master data.';
$operation = 'Update master data';
$payloadType = 'Users';
$flowId = '123456789';
$ids = [['idType' => 'UserId', 'values' => [1,2,3,4]]];
$metadata = [['name' => 'Script type', 'value' => 'PHP']];
$result = $agent->logTransaction($from,
$to,
$status,
$message,
$operation,
$payloadType,
$flowId,
$ids,
$metadata);
logTransaction
function returns a status object that you can use to verify successful communication with Aino.io.
Successfull case:
array(
'message' => "Request successfully sent",
'status' => "success",
'response' => "{"batchId":"6bf0f705-9431-475b-931d-064203d3d81b"}"
);
Example of an error case when using invalid/disabled API key:
array(
'message' => "401 Unauthorized",
'status' => "failure",
'response' => "Invalid API key"
);
Check samples directory.
- XDebug: PHPUnit requires also XDebug to produce JUnit log and other code coverage data.