nowo-tech/fragment-kit-bundle

Symfony bundle: resilient Twig fragment rendering with optional fallback template and Sentry reporting.

Maintainers

Package info

github.com/nowo-tech/FragmentKitBundle

Documentation

Type:symfony-bundle

pkg:composer/nowo-tech/fragment-kit-bundle

Transparency log

Statistics

Installs: 45

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-16 08:23 UTC

This package is auto-updated.

Last update: 2026-07-16 08:26:35 UTC


README

CI Packagist Version Packagist Downloads License PHP Symfony Coverage

Found this useful? Give it a star on GitHub! It helps us maintain and improve the project.

Symfony bundle that makes Twig fragment sub-requests resilient when using {ignore_errors: true}.

Features

  • HTTP error tolerance{ignore_errors: true} also covers 403/404 (not only exceptions)
  • Twig fallback — configurable template (or empty string)
  • Optional Sentry — report suppressed failures without breaking the parent page
  • Flex recipe — ships nowo_fragment_kit config
  • FrankenPHP demo — Symfony 8 single-container demo

FrankenPHP: Demos use a single PHP service (FrankenPHP, no nginx). With APP_ENV=dev (default), the Docker entrypoint swaps in Caddyfile.devphp_server without workers for local development. The production Caddyfile can use php_server { worker … }; see docs/DEMO-FRANKENPHP.md.

Problem

{{ render(controller(...), {ignore_errors: true}) }} only suppresses exceptions thrown during sub-requests. When the sub-request returns an HTTP error status (403, 404, …), FragmentHandler::deliver() throws a RuntimeException and the parent page still fails with a 500.

Installation

composer require nowo-tech/fragment-kit-bundle

Register the bundle (Flex does this automatically):

Nowo\FragmentKitBundle\NowoFragmentKitBundle::class => ['all' => true],
{{ render(controller('App\\Controller\\WidgetController::index'), {ignore_errors: true}) }}

Requirements

  • PHP >= 8.2, < 8.6
  • Symfony ^7.4 || ^8.0 (CI covers 7.4, 8.0, 8.1)
  • Twig Bundle

Documentation

Additional documentation

Version information

Version PHP Symfony Status
1.0.x >= 8.2 7.4 – 8.1+ Stable

Demos

make -C demo up-symfony8   # http://localhost:8050 (default PORT)

Tests and coverage

make test
make test-coverage
  • Tests: PHPUnit (unit + integration)
  • PHP: 100% lines (make test-coverage)

Development

make setup-hooks
make up
make install
make release-check

License

MIT — see LICENSE.