Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Templating Extra Bundle Laravel Package

mremi/templating-extra-bundle

mremi/templating-extra-bundle is a Symfony bundle that adds extra templating helpers and Twig extensions, making views cleaner and more reusable. It provides convenient utilities for common template tasks so you can reduce custom boilerplate in your application’s presentation layer.

View on GitHub
Deep Wiki
Context7

Getting Started

Install via Composer and register the bundle in your dev/test environment only — it exists to feed the Symfony web profiler, so there's no reason to load it in production:

composer require --dev mremi/templating-extra-bundle

Modern Symfony (4+) — add to config/bundles.php:

return [
    // ...
    Mremi\TemplatingExtraBundle\MremiTemplatingExtraBundle::class => ['dev' => true, 'test' => true],
];

Legacy Symfony (2.x/3.x) — register in AppKernel::registerBundles():

if (in_array($this->getEnvironment(), ['dev', 'test'])) {
    $bundles[] = new Mremi\TemplatingExtraBundle\MremiTemplatingExtraBundle();
}

If the bundle exposes a config tree, drop it in config/packages/dev/mremi_templating_extra.yaml (or app/config/config_dev.yml on legacy) and enable it:

mremi_templating_extra:
    enabled: true

Then load any page in dev, open the profiler (/_profiler), and pick a request. A Templates panel shows every template the templating layer rendered for that request — name, render time, and the parameters each render was invoked with.

First useful case: you have a slow page and the stock Twig panel tells you which templates are loaded, not which are rendered. Open the Templates panel, sort by count, and look for partials being rendered dozens of times inside a loop.

Implementation Patterns

  • Slow-page triage. Start with the total request duration on the toolbar, drill into Templates, and look for a single template accounting for most of the render time. Cross-check with the Timeline panel to distinguish time spent in the template from controller/DB work feeding it.
  • Catching duplicate includes. If _sidebar.html.twig shows up forty times with identical parameters, a loop is re-including it. Hoist the include out of the loop, cache the fragment, or pass it once from the controller.
  • Untangling inheritance chains. The panel lists templates in render order, which makes it easy to reconstruct the parent → child → {% embed %} chain for a page you didn't write.
  • Before/after refactors. Record a page's template list and timings, refactor (split a monolith, extract a fragment), reload, and diff. This is the bundle's best real use case — a cheap regression check on template structure.
  • Pair it with Twig's profiler. Twig's panel gives you source, loaded-vs-rendered, and block structure. This bundle is about execution — how many times, how long, with what context. Use them side by side.
  • Programmatic access. The underlying data collector is reachable via $profiler->getCollector('templating') (exact name varies by version), so you can pull the rendered list inside a test or a console command if you want to assert "this page renders no more than N templates."

Gotchas and Tips

  • This project is effectively unmaintained. Six stars, zero dependents, last activity years ago — it targets Symfony 2.x/3.x. Check the composer.json constraints before installing; on Symfony 5/6 the bundle config and the templating service it decorates have both moved, and you'll get either a "class not found" or an incompatible decoration error.
  • PHP templating is gone. Symfony removed the PHP templating engine in 3.0, so any .phtml support the bundle advertises is dead weight. You're using it for the Twig side or not at all.
  • It only intercepts the templating layer's render() path. Templates pulled in via {{ render(controller(...)) }} sub-requests, ESI, or anything bypassing the decorated service may not show up. If a template you know is on the page is missing, that's the first thing to suspect.
  • Dev-only for a reason. The bundle decorates the templating service and records timing on every render. In production it costs memory and produces a collector nobody reads.
  • Panel missing = collector not registered. Verify the bundle is enabled for the current environment and that the compiler pass ran: bin/console debug:container --tag=data_collector.
  • Profiler truncation on heavy pages. The profiler only stores recent requests and large profiles can be trimmed. Hit /_profiler directly rather than relying on the toolbar for big pages.
  • Minimal extension points. There's no documented hook to customize the collector's output. If you need richer data (per-template parameters, memory, block timings), write a small Twig extension or lean on the built-in Twig profiler — don't invest in extending this bundle.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core