Download the PHP package fido/php-xray without Composer
On this page you can find all versions of the php package fido/php-xray. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fido/php-xray
More information about fido/php-xray
Files in fido/php-xray
Informations about the package php-xray
fido-id/php-xray
An instrumentation library for AWS X-Ray for PHP 8.x LICENSE CHANGELOG
Installation
To use this package, use Composer:
- From CLI:
composer require fido-id/php-xray
- Or, directly in your
composer.json
:
Usage
Start a new trace, create a new segment, add any desired subsegment, close it and submit it.
eg.
Closing segments is mandatory before submitting, closing a parent segment will automatically close any child segment.
Available built-in segments
Segment
: Default simple segment extended by any other segment in this list.RemoteSegment
: A segment with the$traced
boolean property, extended by the other segment.DynamoSegment
: A segment thought for Dynamo operations with$tableName
,$operation
and$requestId
dynamo related properties.HttpSegment
: A segment thought for operation over HTTP with$url
,$method
and$responseCode
related properties. It also features acloseWithPsrResponse
helper method which allows to populate and close the segment with an object implementing thePsr\Http\Message\ResponseInterface
interface.SqlSegment
: A segment thought for SQL operations with$query
property and$url
,$preparation
,$databaseType
,$databaseVersion
,$driverVersion
and$user
optional properties.
You may want to extend one of the above class to instrument custom segments for metadata, annotation and aws data custom handling (Remember to extend
__construct
andjsonSerialize
methods accordingly).
Fault and error handling
Any segment has the $fault
and $error
boolean properties that can be used accordingly, also you can set the cause with a Cause
object.
eg.
How to test the software
You can run the library test suite with PHPUnit by running composer test
script, you can also run composer mutation
script for mutation testing report.
Known issues
- Segments currently support only
Cause
object but notexception ID
. - Submitting open segment is not supported yet.
Getting help
If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker.
Getting involved
Feedbacks and pull requests are very welcome, more on how to contribute on CONTRIBUTING.
Credits and references
This library is inspired by patrickkerrigan/php-xray, initially we thought to fork it but ended up re-writing it from scratch using PHP8 named constructors instead of fluent approach which allow us to have always valid entities instantiated.
All versions of php-xray with dependencies
ext-json Version *
ext-sockets Version *
webmozart/assert Version ^1.11