devorto/exception-handler
最新稳定版本:4.0.0
Composer 安装命令:
composer require devorto/exception-handler
包简介
A class to convert standard php errors to exceptions and supports to log (un)caught to php-log and other loggers using LoggerInterface.
README 文档
README
Always wanted to convert php errors to exceptions? Or catch "uncaught exceptions" so you can log them with a logger?
Don't look any further and include this class now! 😁
Example
<?php // Init ExceptionHandler class: \Devorto\ExceptionHandler::init(); // Add a logger. \Devorto\ExceptionHandler::addLogger(new AnyLoggerImplementingLoggerInterface()); // This class removes the need of using `@` before php standard methods because we can now catch and continue with our code but still log that this happened. try { mkdir('/existing-path-which-results-in-a-notice'); } catch (ErrorException $exception) { // Log "caught" exception. \Devorto\ExceptionHandler::log($exception); } /** * This will result in a HTTP 500 Error Page. * This will however be logged using the exception handler and provided loggers. */ throw new Exception('It broke!');
统计信息
- 总下载量: 2.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-28