vmpublishing/psr15-middleware-error-handler 问题修复 & 功能扩展

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

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

vmpublishing/psr15-middleware-error-handler

Composer 安装命令:

composer require vmpublishing/psr15-middleware-error-handler

包简介

dependency-less middleware to capture and process any throwable with a dedicated error handler

README 文档

README

Build Status Code Coverage Scrutinizer Code Quality

WHAT

PSR-15 error handling middleware with as low dependencies as possible.

for productive use we like a middleware that captures and processes error into a nicer format (if possible)

this comes with two handler implementations. one just rethrow the error (for development purposes) one responds with the contents of a predefined file and a correct status code (for production use)

INSTALL

To install simply use composer require vmpublishing/psr15-middleware-error-handler:*@stable

USE

This is quite simple: define your handler and add the middleware;

use VM\ErrorHandler\Services\RethrowHandler;

$handler = new RethrowHandler();
$middleware = new ErrorProcessor($handler);

// and for slim, given $app
$app->add($middleware);

// or just add it on the routes you want it on

For the StaticFileHandler you need to pass in at least one file and an empty Response object;

use VM\ErrorHandler\Services\StaticFileHandler;

$handler = new StaticFileHandler('/path/to/500.html', $emptyResponse);
$middleware = new ErrorProcessor($handler);

// and for slim, given $app
$app->add($middleware);
// ...

To have specific ErrorCodes, you need to use the Http Exceptions from this library, ie: NotFound

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固