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
Instalation
- Download using composer
composer require wernerdweight/enhanced-exception
- 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!', ]; }
- 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
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-01