PHP code example of zafarjonovich / php-safe-exception

1. Go to this page and download the library: Download zafarjonovich/php-safe-exception 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/ */

    

zafarjonovich / php-safe-exception example snippets





afarjonovich\PHPSafeException\saver\FileSaver;
use zafarjonovich\PHPSafeException\converter\JsonConverter;

try {
    throw new \Exception('My awesome exception');
} catch (\Exception $exception) {
    $saver = new FileSaver('exceptions/'.time().'.txt');
    $saver->save(new JsonConverter($exception));
}





farjonovich\PHPSafeException\saver\FileSaver;
use zafarjonovich\PHPSafeException\saver\TelegramBotSaver;
use zafarjonovich\PHPSafeException\components\MultipleSaver;
use zafarjonovich\PHPSafeException\converter\TextConverter;

try {
    throw new \Exception('My awesome exception');
} catch (\Exception $exception) {
    
    $saver = new MultipleSaver();
    
    $saver->addSaver(new FileSaver('exceptions/'.time().'.txt'));
    $saver->addSaver(new TelegramBotSaver('BOT_TOKEN',['chat_id1','chat_id2','chat_id3']));
    
    $saver->save(new TextConverter($exception));
    
}


"zafarjonovich/php-safe-exception": "*"