PHP API Library

How to use PHP API Library

Step 1

Download the API Library "Logs.php" from

Step 2

Open php.ini and add the path of the Logs.php class file in auto_prepend_file directive. Learn more about auto_prepend_file.

auto_prepend_file = "path/to/Logs.php"
Alternatively, if you do not have access to php.ini, you can create .htaccess file on your project root and add the following line in it.
php_value  auto_prepend_file "path/to/Logs.php"

Step 3

Open Logs.php class file and change the following setting with your API key. Your API key can be found at the Account Settings page.

<?php const API_KEY 'YOUR-API-KEY'?>
You can also set the value for DEBUG to true if you want to display errors on your site.
<?php const DEBUG true?>


With the completion of the above 3 steps, you are done setting up the library and its ready to use. You do not have to include the Logs.php class file anywhere as it will be included automatically as per the settings done in Step 2 above. To see it in action, open any php page inside your project and write a code that would generate an error. For example, let us see an example of generating a fatal error. Lets call a function that has not yet defined.

<?php TestFunc(); // Calling a non declared function. ?>
Once you execute the above script, it will silently (assuming DEBUG is set to false) send the error log to your account. You can see the log from your account dashboard.

Sending Logs Manually

You can also manually send your logs using the Send() method. You do not have to create an instance of the Logs class since its already created inside the Logs.php file.

// Try code here..
} catch(Exception $e){
$type 'INFO'//Optional. Possible values INFO, WARNING, ERROR.
$Log->Send($e->getMessage(), $type);