1. Go to this page and download the library: Download ultimate-apm/ultimate-php 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/ */
ultimate-apm / ultimate-php example snippets
use Ultimate\Ultimate;
use Ultimate\Configuration;
$configuration = new Configuration('YOUR_BUGTRAP_KEY');
$ultimate = new Ultimate($configuration);
// Start an execution cycle with a transaction
$ultimate->startTransaction($_SERVER['PATH_INFO']);
$result = $ultimate->addSegment(function ($segment) {
// Do something here...
return "Hello World!";
}, 'my-process');
echo $result; // this will print "Hello World!"
class CustomTransport implements \Ultimate\Transports\TransportInterface
{
protected $configuration;
protected $queue = [];
public function __constructor($configuration)
{
$this->configuration = $configuration;
}
public function addEntry(\Ultimate\Models\Arrayable $entry)
{
// Add an \Ultimate\Models\Arrayable entry in the queue.
$this->queue[] = $entry;
}
public function flush()
{
// Performs data transfer.
$handle = curl_init('https://www.palzin.app');
curl_setopt($handle, CURLOPT_POST, 1);
curl_setopt($handle, CURLOPT_HTTPHEADER, [
'X-Ultimate-Key: xxxxxxxxxxxx',
'Content-Type: application/json',
'Accept: application/json',
]);
curl_setopt($handle, CURLOPT_POSTFIELDS, json_encode($this->queue));
curl_exec($handle);
curl_close($handle);
}
}
$ultimate->setTransport(function ($configuration) {
return new CustomTransport($configuration);
});
shell
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.