Creates http exceptions which can be catched and converted to error responses.
- php: ^8.2
Through Composer as chubbyphp/chubbyphp-http-exception.
composer require chubbyphp/chubbyphp-http-exception "^1.2"
<?php
declare(strict_types=1);
namespace App;
use Chubbyphp\HttpException\HttpException;
$exception = new \RuntimeException('error');
$httpException = HttpException::createBadRequest([
'key1' => 'value1',
'key2' => 'value2'
], $exception);
2025 Dominik Zogg