1. Go to this page and download the library: Download matapatos/wp-exceptions 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/ */
matapatos / wp-exceptions example snippets
use Attributes\Wp\Exceptions\ExceptionHandler;
ExceptionHandler::register();
throw new HttpException(headers: ['My-Header' => 'Value 123']);
$exceptionHandler = ExceptionHandler::getOrCreate();
$exceptionHandler->onException(CustomException::class, fn($ex) => echo "A custom exception has been raised");
// themes/sage/functions.php
Application::configure()
->withProviders([
App\Providers\ThemeServiceProvider::class,
])
->boot();
ExceptionHandler::register(force: true); // We are using force true in case the ExceptionHandler has been registered before e.g. in a plugin
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.