PHP code example of xray-log / php-sdk
1. Go to this page and download the library: Download xray-log/php-sdk 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/ */
xray-log / php-sdk example snippets
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']);
// 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]);