xray-log / php-sdk
XRay Log PHP SDK for logging and monitoring
v1.3.0
2024-12-23 19:10 UTC
Requires
- php: >=7.2.5
- ext-curl: *
- ext-json: *
- symfony/var-dumper: >=5.4
Requires (Dev)
- guzzlehttp/guzzle: ^7.0
- php-mock/php-mock-phpunit: ^2.0
- phpunit/phpunit: ^8.0
README
XRay Log PHP SDK for logging and monitoring applications. This SDK provides a simple way to log various data types with type preservation.
Installation
You can install the package via composer:
composer require xray-log/php-sdk
Usage
Using Logger Class
use XRayLog\XRayLogger; // Initialize logger $logger = new XRayLogger('Your Project Name'); // Log messages $logger->info("User logged in"); $logger->error("Something went wrong"); $logger->debug(['user_id' => 1, 'status' => 'active']);
Using Helper Function
// Set project name (optional) xray_setup(['project' => 'My Project']); // Log with default INFO level xray("Simple message"); // Log with specific level xray('error', "Something went wrong"); xray('debug', ['user_id' => 1]);
Testing
composer test
License
The XRay Log PHP SDK is open-sourced software licensed under the MIT license.