papimod/http-error 问题修复 & 功能扩展

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

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

papimod/http-error

最新稳定版本:v2.1.0

Composer 安装命令:

composer require papimod/http-error

包简介

Module Papi

README 文档

README

Description

Help integrate error and warning handling into your papi.

This module is based on the official tutorial.

⚠︎ We advise against modifying the configuration of the “common module

Prerequisites Modules

Configuration

ENVIRONMENT (.ENV)

Required No
Type PRODUCTION, DEVELOPMENT, TEST or null
Description Display error details when is not set to PRODUCTION
Default null

Usage

You can add the following options to your .env file:

ENVIRONMENT=DEVELOPMENT

Import the module when creating your application:

require __DIR__ . "/../vendor/autoload.php";

use Papi\PapiBuilder;
use Papimod\Dotenv\DotEnvModule;
use Papimod\Common\CommonModule;
use Papimod\HttpError\HttpErrorModule;
use function DI\create;

$builder = new PapiBuilder();

$builder
    ->setModule(
        DotEnvModule::class, # Prerequisite
        CommonModule::class,
        HttpErrorModule::class
    )
    ->build()
    ->run();

Use one of the following exceptions whenever you want:

use Papi\abstract\PapiGet;
use Papimod\HttpError\exception\NotImplementedException;
use Slim\Psr7\Request;
use Slim\Psr7\Response;

final class NotImplementedGet extends PapiGet
{
    public static function getPattern(): string
    {
        return "/notImplemented";
    }

    public function __invoke(Request $request, Response $response): Response
    {
        throw new NotImplementedException($request);
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2025-12-08