wernerdweight/enhanced-exception 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

wernerdweight/enhanced-exception

最新稳定版本:2.0.0

Composer 安装命令:

composer require wernerdweight/enhanced-exception

包简介

Generic enhanced exception to be used in other projects

README 文档

README

Generic enhanced exception to be used in other projects

Build Status Latest Stable Version Total Downloads License

Instalation

  1. Download using composer
composer require wernerdweight/enhanced-exception
  1. Define your exceptions
use WernerDweight\EnhancedException\Exception\AbstractEnhancedException;

class MyException extends AbstractEnhancedException
{
    /** @var int */
    public const EXCEPTION_SOMETHING_BAG_HAPPENED = 1;
    /** @var int */
    public const EXCEPTION_DIDNT_EXPECT_SPANISH_INQUISITION = 2;

    /** @var string[] */
    protected static $messages = [
        self::EXCEPTION_SOMETHING_BAG_HAPPENED => 'Something bad happened! Helpful, I know.',
        self::EXCEPTION_DIDNT_EXPECT_SPANISH_INQUISITION => 'Didn\'t expect Spanish inquisition to reach user %s!',
    ];
}
  1. Use your exceptions
throw new MyException(MyException::EXCEPTION_DIDNT_EXPECT_SPANISH_INQUISITION, [$user->getUsername()]);
// will throw `Didn't expect Spanish inquisition to reach user Ferdinand II!`

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-01