chubbyphp/chubbyphp-http-exception

Creates http exceptions which can be catched and converted to error responses.

1.2.0 2024-12-08 06:58 UTC

This package is auto-updated.

Last update: 2024-12-08 07:01:08 UTC


README

CI Coverage Status Mutation testing badge Latest Stable Version Total Downloads Monthly Downloads

bugs code_smells coverage duplicated_lines_density ncloc sqale_rating alert_status reliability_rating security_rating sqale_index vulnerabilities

Description

Creates http exceptions which can be catched and converted to error responses.

Requirements

  • php: ^8.2

Installation

Through Composer as chubbyphp/chubbyphp-http-exception.

composer require chubbyphp/chubbyphp-http-exception "^1.2"

Usage

<?php

declare(strict_types=1);

namespace App;

use Chubbyphp\HttpException\HttpException;

$exception = new \RuntimeException('error');

$httpException = HttpException::createBadRequest([
    'key1' => 'value1',
    'key2' => 'value2'
], $exception);

Copyright

2024 Dominik Zogg