symkit/error-bundle 问题修复 & 功能扩展

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

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

symkit/error-bundle

Composer 安装命令:

composer require symkit/error-bundle

包简介

Premium error page templates for Symfony applications

README 文档

README

CI Latest Version PHPStan Level 9

Premium error page templates for Symfony applications. Overrides default Symfony error pages with a modern terminal-themed design.

Installation

composer require symkit/error-bundle twig/intl-extra

The error templates use Twig Intl filters (format_datetime, etc.). With Twig enabled, you must register the Intl extension, for example in config/packages/twig.yaml:

twig:
    extra:
        intl: true

(or register Twig\Extra\Intl\IntlExtension as a service tagged twig.extension). If the bundle is enabled and Twig is present but the extension is missing, the container build fails with a message describing these steps.

If not using Symfony Flex, register the bundle manually in config/bundles.php:

return [
    // ...
    Symkit\ErrorBundle\SymkitErrorBundle::class => ['all' => true],
];

Configuration

# config/packages/symkit_error.yaml
symkit_error:
    enabled: true              # default: true — set to false to use Symfony default error pages
    website_name: 'Your Brand' # default: 'Symkit' — trimmed, max 200 characters; empty becomes default
    home_path: '/'             # default: '/' — see "Home path (security)" below
  • enabled : when false, the bundle does not override error pages (Symfony defaults are used) and does not register the Twig globals.
  • website_name : name displayed on error pages. Exposed in Twig as the global symkit_error_website_name. Values longer than 200 characters or blank (after trim) fall back to Symkit.
  • home_path : target for “Back to homepage” and brand/footer links. Exposed as symkit_error_home_path. See below.

Home path (security)

home_path must be a safe app-relative path so links cannot be turned into javascript:, data:, protocol-relative (//…), or absolute URLs. Allowed shape:

  • Starts with exactly one / (not //)
  • Path segments: letters (including Unicode), digits, _, -, ., ~
  • Optional ?query and #fragment (query/hash are not validated as strictly as the path; keep them trusted)
  • Maximum length 2048 characters

Invalid or unsafe values are silently replaced with /. For an external homepage URL, override the templates and build the link yourself (e.g. with a parameter you control).

Included Templates

Template HTTP Code Description
error404.html.twig 404 Page not found
error403.html.twig 403 Forbidden access
error401.html.twig 401 Unauthorized
error429.html.twig 429 Too many requests
error503.html.twig 503 Service unavailable / maintenance
error.html.twig 5xx Generic server error
base_error.html.twig Base layout for all error pages

All these pages set <meta name="robots" content="noindex, follow"> where applicable.

Internationalization

The bundle ships with French and English translations. The locale is determined by the application's current locale (app.request.locale).

To override translations, create your own XLIFF file using the SymkitErrorBundle domain.

Customization

Override any template in your application by creating the corresponding file:

templates/bundles/TwigBundle/Exception/error404.html.twig

The base layout exposes these Twig blocks: error_title, meta_robots, cursor_color, glow_effect, terminal_card, error_content, footer_link. It uses the Twig globals symkit_error_website_name and symkit_error_home_path. The main landmark is <main id="main-content" class="error-container">. Decorative SVGs use aria-hidden="true" and focusable="false".

Contributing

make install   # Install dependencies
make ci        # Full pipeline: audit, quality (CS, PHPStan, Deptrac, PHPUnit, Infection)

Never commit code that fails make ci.

License

MIT

symkit/error-bundle 适用场景与选型建议

symkit/error-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「symfony」 「error」 「bundle」 「templates」 「error-pages」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 symkit/error-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 symkit/error-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 symkit/error-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-21