定制 middlewares/error-response 二次开发

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

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

middlewares/error-response

最新稳定版本:v1.1.0

Composer 安装命令:

composer require middlewares/error-response

包简介

Middleware to handle responses with error status code (4xx-5xx)

README 文档

README

Latest Version on Packagist Software License Testing Total Downloads

Middleware to format responses with HTTP error codes (4xx-5xx). Useful to create pretty 404 or 500 error pages.

Requirements

Installation

This package is installable and autoloadable via Composer as middlewares/error-response.

composer require middlewares/error-response

Example

use Middlewares\ErrorResponse;

Dispatcher::run([
    new Middlewares\ErrorResponse()
]);

Usage

The constructor accepts an array of responders, that must implement the Middlewares\ErrorResponder\ResponderInterface. This package includes two basic responders: for html and json responses, that are enabled by default if no responders are passed.

//The default responders (for html and js)
$responder = new Middlewares\ErrorResponse();

//Use your custom responders
$responder = new Middlewares\ErrorResponse([
    new MyHtmlResponder(),
    new MyJsonResponder()
]);

Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.

The MIT License (MIT). Please see LICENSE for more information.

统计信息

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

GitHub 信息

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

其他信息

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