PHP code example of webpractik / sentry

1. Go to this page and download the library: Download webpractik/sentry 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/ */

    

webpractik / sentry example snippets




if (class_exists('Dotenv\\Dotenv')) {
    $env = Dotenv\Dotenv::createImmutable($_SERVER['DOCUMENT_ROOT']);
    // Если на проекте используется другое имя файла, его можно задать вторым параметром
    // пример, $env = Dotenv\Dotenv::createImmutable($_SERVER['DOCUMENT_ROOT'], '.environment');
    try {
        $env->load();
    } catch (InvalidFileException | InvalidPathException $e) {
    }
}

if (class_exists('Dotenv\\Dotenv')) {
    $env = Dotenv\Dotenv::create($_SERVER['DOCUMENT_ROOT']); // изменение тут, в старой версии нет метода createImmutable
    // Если на проекте используется другое имя файла, его можно задать вторым параметром
    // пример, $env = Dotenv\Dotenv::create($_SERVER['DOCUMENT_ROOT'], '.environment');
    try {
        $env->load();
    } catch (InvalidFileException | InvalidPathException $e) {
    }
}

'exception_handling' =>
    array (
        'value' =>
            array (
                'debug' => <bool>,
                'handled_errors_types' => <int>,
                'exception_errors_types' => <int>,
                'ignore_silence' => <bool>,
                'assertion_throws_exception' => <bool>,
                'assertion_error_type' => <int>,
                'log' =>
                    array (
                        'settings' =>
                            array (
                                'file' => '<path_to_error_log>/error.log',
                                'log_size' => <int>,
                            ),
                        'class_name' => '\\Webpractik\\Sentry\\SentryException',
                    ),
            ),
        'readonly' => <bool>,
    ),