Skip to main content

How configuration is created

The bundle alias is nowo_twig_inspector. Symfony automatically loads any config file that matches this alias:
  • config/packages/nowo_twig_inspector.yaml (all environments)
  • config/packages/dev/nowo_twig_inspector.yaml (dev only)
Symfony Flex (Packagist install) creates the config and routes files automatically — no manual step needed. Git or private repo install — run the install command:
This creates config/packages/dev/nowo_twig_inspector.yaml and updates config/routes.yaml. Use --force to overwrite an existing config file, and --env=test for the test environment.
The bundle works without any config file. All options fall back to their defaults from Configuration.php when no YAML is present.

Config options reference

array
default:"['.html.twig']"
Template file extensions the inspector instruments. Add .twig if you use bare Twig files.
array
default:"[]"
Template names or glob-style patterns to exclude from inspection. Supports * wildcards.
array
default:"[]"
Block names or glob-style patterns to exclude. Supports * wildcards.
array
default:"[]"
Additional exclusion patterns as regular expressions. Applied alongside excluded_templates.
array
default:"[]"
Template name prefixes to exclude, for namespace-style filtering.
array
default:"[]"
Regular expression patterns for block exclusion.
boolean
default:"true"
Collect template and block metrics (render counts, timing) in the Web Profiler. Set to false to reduce collector overhead.
boolean
default:"false"
When true, inject inspector comments during sub-requests (e.g. when main content is rendered as a fragment via render(controller(...))). Enable this if all templates show “sub-request” and none get inspected.
Name of the cookie used to enable/disable the inspector. Change this if it conflicts with another cookie in your app.
integer
default:"0"
Maximum nesting depth for comment injection. 0 means unlimited. Reducing this can lower overhead on very deep template trees.
string
default:"light"
Visual theme for the overlay popup. Accepted values: light, dark, auto.auto follows the system prefers-color-scheme setting.
boolean
default:"false"
Use a compact tooltip style for the overlay popup.
boolean
default:"false"
Minimize overlay animations. Set to true to respect accessibility preferences, or rely on the system prefers-reduced-motion media query.
string
default:"Ctrl+Shift+T"
Keyboard shortcut that toggles the inspector (same as the Enable checkbox; reloads the page). Set to an empty string to disable the shortcut.

Full example config

Exclusion patterns

The three exclusion mechanisms can be combined: All three lists are checked in order; a template is excluded if it matches any of them.

Routes configuration

The “open in IDE” links require the bundle routes to be imported only in dev and test. The Flex recipe and install command both handle this automatically. If you need to add them manually:
Never import the bundle routes without a when@dev / when@test guard. The controller returns 404 in production as a safety measure, but the routes themselves must not be registered in prod.