定制 bsadnu/php-exceptions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

bsadnu/php-exceptions

Composer 安装命令:

composer require bsadnu/php-exceptions

包简介

The helpful custom PHP exceptions and exception interfaces

README 文档

README

Latest Stable Version Total Downloads License

This lets you catch different-layers-specific exceptions (if needed).

Installation

The best way to use this component is through the Composer:

composer require bsadnu/php-exceptions

Usage

  • You may use exceptions within the standard throwing/catching mechanism or even extend them in any way you want:
use Bsadnu\Exception\Base\InvalidArgumentException;

...

try {
    ...
} catch (InvalidArgumentException $exception) {
    ...
} 
use Bsadnu\Exception\Base\TypeError;

...

throw new TypeError($message);
  • It is really helpful to catch either the base BaseExceptionInterface or any other. Therefore, you can control a group of exceptions. Moreover, you may add manually as many specific interfaces as you wish.

More detailed description

All exceptions used in this library implements \Bsadnu\Exception\Interfaces\BaseExceptionInterface, and extend one of the SPL extensions. This way, you have several ways of catching specific extension groups:

  1. Catch all exceptions: \Exception
  2. Catch all exceptions thrown by the library: \Bsadnu\Exception\Interfaces\BaseExceptionInterface
  3. Catch a specific SPL exception: \LogicException
  4. Catch a specific exception thrown by the library: \Bsadnu\Exception\Base\LogicException

Contributing

All feedback / bug reports / pull requests are welcome.

License

This code is licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固