chubbyphp/chubbyphp-http-exception

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

1.1.0 2023-12-02 17:19 UTC

This package is auto-updated.

Last update: 2024-07-13 20:48:13 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.1

Installation

Through Composer as chubbyphp/chubbyphp-http-exception.

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

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