nelmio/esi-debug-bundle
A Symfony bundle that adds debugging support for Edge Side Includes (ESI). Use it during development to inspect ESI fragments, understand how includes are rendered behind a caching reverse proxy such as Varnish, and troubleshoot fragment caching and request behavior more easily.
This bundle is archived and targets the Symfony 2/3 era. Before writing any code, verify compatibility against your Symfony version — on Symfony 4+ assume it will not boot and plan an alternative (see Gotchas). If you are on a legacy app:
composer require --dev nelmio/esi-debug-bundle
app/AppKernel.php:
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Nelmio\EsiDebugBundle\NelmioEsiDebugBundle();
}
# app/config/config.yml
framework:
esi: true
Your front controller must route through AppCache / HttpCache (or a reverse proxy like Varnish), otherwise there is no ESI layer to inspect.{{ render_esi(controller('...')) }}), then open the Symfony profiler and inspect the ESI panel in the web debug toolbar.First use case: confirm which fragments were rendered as ESI subrequests and what the cache did with each one, instead of guessing from a blank page or stale content.
Dev-only toolbar inspection. The primary workflow is browser-driven: render a page, open the profiler, and read the ESI panel to see the subrequest tree and cache status per fragment. Treat it as a read-only diagnostic, not part of application logic.
Compose a "cache rehearsal" page. Build a route that fans out to several ESI fragments with different s-maxage, Vary, and cookie behavior. Use it as a repeatable fixture to compare behavior before/after config changes — the debug output becomes your regression signal.
Pair with native cache headers. Cross-check the bundle's view against X-Symfony-Cache (emitted by HttpCache) or your proxy's X-Cache header. The bundle's panel is the summary; the raw headers are the ground truth when they disagree.
Fragment-level workflows. Typical checks:
Isolate debugging from production. Register the bundle only in dev, and keep any instrumentation-driven routes behind the dev firewall. Do not let fragment-testing routes leak into prod routing.
composer.json constraints first; on Symfony 4+ this is effectively a dead end.HttpCache, FOSHttpCacheBundle for proxy-aware debugging, or plain X-Symfony-Cache / proxy X-Cache headers. These cover most of what this bundle did.AppCache/HttpCache/Varnish (e.g., direct kernel invocation in tests or php -S without the cache wrapper), you get zero ESI activity and an empty panel — this is the most common "it's broken" false alarm.Set-Cookie on a fragment turns it private; the panel will show misses that look like a config bug but are correct behavior.framework.esi: true, confirm the request hit HttpCache, check X-Symfony-Cache on the parent and each fragment, then re-render with the toolbar disabled and compare.How can I help you explore Laravel packages today?