mobile

Table of contents

close
Illustration
Configuration
Rest api documentation
Title of section

Title

Subtitle

You can install the PHP Interceptor through Composer by running the following command:





































Example
function cg_get_user()
{
    global $currentUser;
    return [
        "ID" => $currentUser->data->ID,
        "Username" => $currentUser->data->user_login,
        "Display Name" => $currentUser->data->display_name,
        "Email" => $currentUser->data->user_email,
        "Registration Date" => $currentUser->data->user_registered
    ];
}




































Subtitle 11

You can install the PHP Interceptor through Composer by running the following command:

composer require crashguard/php




































More text





































Title 2

Subtitle 2

You can install the PHP Interceptor through Composer by running the following command:





































Subtitle 22

You can install the PHP Interceptor through Composer by running the following command:

composer require crashguard/php







































































More text





































Title 3




































Subtitle 3

You can install the PHP Interceptor through Composer by running the following command:




























Subtitle 33

You can install the PHP Interceptor through Composer by running the following command:

composer require crashguard/php




































More text





































Registering the API key

Installation

You can install the PHP Interceptor through Composer by running the following command:

composer require crashguard/php

Configuration

Registering the API key

Before you can catch incidents in your application, you need to register the CrashGuard API key. You can do it in two ways:

1. Store the key as an environment variable
putenv( "CrashGuardAPIKey=YOUR_API_KEY" );
2. Define a named constant:
putenv( "CrashGuardAPIKey=YOUR_API_KEY" );

Tracking the user

You can register a function called cg_get_user. The function should return an associative array that contains the user information. If defined, we will call this function whenever an incident happens inside your application to get the user information (if any).

Example
function cg_get_user()
{
    global $currentUser;
    return [
        "ID" => $currentUser->data->ID,
        "Username" => $currentUser->data->user_login,
        "Display Name" => $currentUser->data->display_name,
        "Email" => $currentUser->data->user_email,
        "Registration Date" => $currentUser->data->user_registered
    ];
}




































More text