PHP code example of phphd / exception-toolkit

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

    

phphd / exception-toolkit example snippets


    PhPhD\ExceptionToolkit\Bundle\PhdExceptionToolkitBundle::class => ['all' => true],
    

use PhPhD\ExceptionToolkit\Unwrapper\ExceptionUnwrapper;

/** @var ExceptionUnwrapper $unwrapper */
$unwrapper = getUnwrapper(); 

$compositeException = new CompositeException([
    new InvalidEmailException(),
    new CompositeException([
        new InvalidPasswordException(),
    ]),
]);

[$emailError, $passwordError] = $unwrapper->unwrap($compositeException);
 
public function __construct(
    #[Autowire('@phd_exception_toolkit.exception_unwrapper')] 
    private ExceptionUnwrapper $exceptionUnwrapper,
) {}