承接 juliangut/http-exception 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

juliangut/http-exception

最新稳定版本:0.1.1

Composer 安装命令:

composer require juliangut/http-exception

包简介

HTTP aware exceptions

README 文档

README

PHP version Latest Version License

Build Status Style Check Code Quality Code Coverage

Total Downloads Monthly Downloads

http-exception

HTTP aware exceptions

Installation

Composer

composer require juliangut/http-exception

Usage

Require composer autoload file

require './vendor/autoload.php';

HTTP aware exceptions are just like normal exceptions but carrying an HTTP Status Code

use Jgut\HttpException\HttpException;

$exceptionMessage = 'You shall not pass!';
$exceptionDescription = 'You do not have permission';
$exceptionCode = 1001; // Internal code
$previousException = new \Exception();
$exception = new BadRequestHttpException($exceptionMessage, $exceptionDescription, $exceptionCode, $previousException);

$exception->getStatusCode(); // 400 Bad Request

Additionally exceptions have a description and a unique identifier which can be used in logging and displaying for example on APIs, allowing you to have more information over the erroneous situation when addressed

$exception->getDescription();
$exception->getIdentifier();

Contributing

Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.

See file CONTRIBUTING.md

License

See file LICENSE included with the source code for a copy of the license terms.

统计信息

  • 总下载量: 5.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-02-15