Skip to content
This repository was archived by the owner on Nov 3, 2024. It is now read-only.

controlabs/php-http-exceptions

Repository files navigation

php-http-exceptions

PHP HTTP Exceptions

Build Status Scrutinizer Code Quality Code Coverage Build Status Code Intelligence Status PHPStan

License Latest Stable Version Latest Unstable Version composer.lock Total Downloads

Installation

composer require controlabs/http-exceptions

Usage

use Controlabs\Http\Exception\BadRequest;

Throws an Bad Request exception:

throw new BadRequest();

Throws an exception with a custom message:

throw new BadRequest("I'm gonna make him an offer he can't refuse.");

Response (it can return in JSON or ARRAY format):

try {
} catch (BadRequest $e) {
    $e->response()->toArray();
    // or
    $e->response()->toJson();
}

License

This software is open source, licensed under the The MIT License (MIT). See LICENSE for details.

About

PHP HTTP Exceptions

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages