1. Go to this page and download the library: Download fido/php-xray 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/ */
fido / php-xray example snippets
$client = new \GuzzleHttp\Client();
$trace = new Trace(name: 'a_new_trace');
$httpSegment = new HttpSegment(
name: \uniqid("http_segment_post_500_"),
url: 'ifconfig.me/ua',
method: 'GET'
);
$httpSegment
->closeWithPsrResponse($client->get('ifconfig.me/ua'))
$trace->addSubsegment($httpSegment);
$trace->end()->submit(new DaemonSegmentSubmitter());
$trace = new Trace(name: 'a_new_trace');
$pdo = new \PDO('a_totally_valid_dsn');
$query = "SELECT * FROM table_name";
$sqlSegment = new SqlSegment(
name: \uniqid("subsegment_sql_"),
query: $query
);
try {
$pdo->exec($query);
} catch (\Throwable $exception) {
$sqlSegment->setError(true);
$sqlSegment->setCause(Cause::fromThrowable($exception));
}
$trace->addSubsegment($sqlSegment);
$trace->end()->submit(new DaemonSegmentSubmitter());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.