memran/marwa-error-handler 问题修复 & 功能扩展

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

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

memran/marwa-error-handler

Composer 安装命令:

composer require memran/marwa-error-handler

包简介

Framework-agnostic PHP error handling with PSR-3 logging, optional debug reporting, and safe fallback rendering.

README 文档

README

Latest Version Total Downloads License PHP Version CI Coverage PHPStan

Production-focused, framework-agnostic PHP error handling with PSR-3 logging, optional debug reporting, and safe fallback rendering for HTTP and CLI applications.

Requirements

  • PHP 8.1 or newer
  • Composer
  • Optional: a PSR-3 compatible logger such as Monolog

Installation

composer require memran/marwa-error-handler

Usage

use Marwa\ErrorHandler\ErrorHandler;

ErrorHandler::bootstrap(
    appName: 'MyApp',
    env: 'production',
    logger: $logger,
    debugbar: $debugReporter, // optional callable/object reporter
);

For manual wiring:

$handler = new ErrorHandler(appName: 'MyApp', env: 'development');
$handler->setLogger($logger);
$handler->setDebugbar($debugReporter);
$handler->register();

Configuration

  • appName: used in logs and fallback pages.
  • env: development, dev, local, and debug enable detailed dev output.
  • logger: any Psr\Log\LoggerInterface; logger failures are safely ignored.
  • debugbar: optional callable or object with addThrowable(), addException(), or addMessage().
  • renderer: optional custom RendererInterface implementation for full control over output.

Safe defaults:

  • Production never renders exception details in HTML.
  • CLI output stays concise in production.
  • Request IDs from headers are validated before being echoed.

Testing

composer install
composer test
composer test:coverage

Static Analysis

composer analyse
composer lint
composer fix

PHPStan runs at max level against src/. PHP-CS-Fixer enforces PSR-12-oriented formatting.

CI/CD

GitHub Actions runs the package on PHP 8.1, 8.2, and 8.3 using the workflow in .github/workflows/ci.yml. The pipeline executes formatting checks, static analysis, and PHPUnit.

Contributing

Open a focused pull request with a clear summary, test evidence, and notes about any behavior changes. Follow the repository conventions in AGENTS.md, keep examples framework-agnostic, and avoid introducing optional integrations as hard runtime dependencies.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固