Warning
The Coralogix PHP SDK will End of Life(EOL) Feb 1st 2024.
For PHP 7.4+, please use the Coralogix’s PHP OpenTelemetry Instrumentation Documentation instead.
Implementation¶
If you will use it simply, you should initialize Composer
application and install Coralogix
PHP SDK:
$ composer init
$ composer require "coralogix/php-coralogix-sdk"
Then you need to include to your script autoload file:
require 'vendor/autoload.php';
And then you can use Coralogix
logger:
<?php
require_once "vendor/autoload.php";
use Coralogix\CoralogixLogger;
// Initialize logger with your credentials
$logger = new CoralogixLogger(
"[YOUR_PRIVATE_KEY_HERE]",
"[YOUR_APPLICATION_NAME]",
"[YOUR_SUBSYTEM_NAME]"
);
// Send log message
$logger->info("Hello from Coralogix PHP SDK");