PHP code example of mekras / bedoved

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

    

mekras / bedoved example snippets



$bedoved = new Bedoved()
// Включить превращение ошибок в исключительные ситуации
$bedoved->enableErrorConversion();
// Включить перехват исключений, не перехваченных приложением
$bedoved->enableExceptionHandling();
// Включить перехват фатальных ошибок
$bedoved->enableFatalErrorHandling();
// Включить отправку извещений об ошибках по e-mail
$bedoved->setNotifyEmails('[email protected]');
// При возникновении ошибки показывать этот файл
$bedoved->setMessageFile('/path/to/file.html');


ved = new Bedoved();
$bedoved->enableFatalErrorHandling();
$bedoved->setFatalErrorHandler(
    /**
     * Ваш обработчик ошибок
     *
     * Чтобы вывести что-нибудь в браузер используйте return.
     *
     * @param ErrorException $e       исключение, содержащее информацию об ошибке
     * @param string         $output  фрагмент вывода, где обнаружено сообщение об ошибке
     *
     * @return string  вывод для браузера
     */
    function (ErrorException $e, $output)
    {
        return 'ERROR: ' . $e->getMessage();
    }
);

$x = new Foo;


ved = new Bedoved();
$bedoved->enableErrorConversion();

try
{
    $x = 1 / 0;
}
catch (ErrorException $e)
{
    echo 'ERROR: ' . $e->getMessage() . PHP_EOL;
}


$bedoved = new Bedoved();
$bedoved
    ->enableErrorConversion()
    ->enableExceptionHandling()
    ->enableFatalErrorHandling()
    ->setNotifyEmails('[email protected]')
    ->setMessageFile('/path/to/file.html');

$bedoved = new Bedoved(true);