承接 webfactory/exceptions-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

webfactory/exceptions-bundle

最新稳定版本:5.2.0

Composer 安装命令:

composer require webfactory/exceptions-bundle

包简介

Building blocks for more user-friendly error pages, plus a simple controller to display error pages during development (helpful prior to Symfony 2.6.3)

README 文档

README

A Symfony Bundle with some Twig templates and blocks to create helpful, user friendly error pages.

⚠️ Please note: At webfactory, we do no longer use this bundle in new projects, since its main functionality was merged into Symfony 2.6 and we prefer to have project-specific templates. However, we still use the wording that we provide with this bundle.

Basic Usage

First, follow the Symfony Documentation to learn how to create and preview custom error pages. Been there, done that? Fine!

Let's say your generic error page extends the base layout of MyWebsiteBundle. Then you may want to have your error.html.twig to look something like this:

{# error.html.twig #} {% extends '@MyWebsite/Layout/base.html.twig' %} {% use '@WebfactoryExceptions/Exception/blocks.html.twig' %} {% block myMainContentContainer %} {{ block('webfactory_exceptions_standardExceptionPage') }} {% endblock %} 

The webfactory_exceptions_standardExceptionPage block has headings, the translated exception description and provides the user with a list of alternatives what they can do next: get back (simulating a browser back), get to the homepage, get to the contact page or google the domain. It may look like this:

Sample rendering of the webfactory_exceptions_standardExceptionPage block

Links to Homepage and Contact Page

A default block in the bundle provides a link to the homepage with the default target /. If your application does not start at /, you need to set the variable homepageUrl.

Also, you may want to set the variable contactUrl to get a link to your contact page in the listed alternatives.

{# error.html.twig #} {% extends '@MyWebsite/Layout/base.html.twig' %} {% use '@WebfactoryExceptions/Exception/blocks.html.twig' %} {% set homepageUrl = "https://www.webfactory.de" %} {% set contactUrl = path('name_of_a_route') %} {# your blocks and definitions... #} 

Filling in Blocks of Base Layouts

If your base layout already features blocks you need to fill with exception specific content, you can do it this way:

{# error.html.twig #} {% extends '@MyWebsite/Layout/base.html.twig' %} {% use '@WebfactoryExceptions/Exception/blocks.html.twig' with webfactory_exceptions_error_title as title, webfactory_exceptions_error_headline as stage_headline %} 

This loads the webfactory_exceptions_error_title block directly into the title block of your base layout, as well as the webfactory_exceptions_error_headline block into the stage_headline block.

Happy error-styling!

Credits, Copyright and License

This bundle was started at webfactory GmbH, Bonn. It was inspired by the blog post How Symfony2 turns exceptions into error pages and how to customize those.

Previous releases of this bundle contained extra code that would help during development to preview your error pages. This code, however, could be merged into the Symfony core in Symfony 2.6, so we could finally remove it from this bundle. Read the announcement when you're interested in historic details.

Copyright 2012-2022 webfactory GmbH, Bonn. Code released under the MIT license.

webfactory/exceptions-bundle 适用场景与选型建议

webfactory/exceptions-bundle 是一款 基于 Twig 开发的 Composer 扩展包,目前已累计 1.24M 次下载、GitHub Stars 达 62, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 1.24M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 63
  • 点击次数: 20
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 62
  • Watchers: 11
  • Forks: 15
  • 开发语言: Twig

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04