PHP code example of kherge / exception

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

    

kherge / exception example snippets


use KHerGe\Exception\AbstractException;

class MyException extends AbstractException
{
}

// Without any arguments.
$exception = new MyException();

// With only a message. ("Example message.")
$exception = new MyException('Example message.');

// With a message format and values to format. ("Example message.")
$exception = new MyException('Example %s.', 'message');

// With only a previous exception.
$exception = new MyException($previous);

// With a message and previous exception.
$exception = new MyException('Example message.', $previous);

// With a message format, values to format, and a previous exception.
$exception = new MyException('Example %s.', 'message', $previous);