Skip to main content
Twig Inspector Bundle is a development tool only. Never register or enable it in the prod environment. Always restrict the bundle and its routes to dev and test.

Requirements

1

Install via Composer

Run the following command in your project root. The --dev flag ensures it is added to require-dev and never installed in production environments.
To pin to the current major version:
2

Register the bundle

If you use Symfony Flex and install from Packagist, the recipe runs automatically and:
  • Registers the bundle in config/bundles.php
  • Creates config/packages/dev/nowo_twig_inspector.yaml
  • Adds routes to config/routes.yaml for dev and test
No manual steps are needed. Continue to step 4 to verify.
3

Add the bundle routes

Skip this step if you used Symfony Flex — routes are already configured by the recipe.
The bundle provides a controller that handles the “open in IDE” redirect. Add its route resource to config/routes.yaml, restricted to dev and test:
The route import must be wrapped in when@dev: and when@test:. Importing without an environment guard would expose the route in production. Even if mistakenly imported, the controller returns 404 in prod as a safety measure — but the bundle itself must never be active there.
4

(Optional) Run the install command

If the Flex recipe did not run (for example, when installing from a private repository or directly from Git), you can use the install command to generate the config file and update routes automatically:
This creates config/packages/dev/nowo_twig_inspector.yaml and updates config/routes.yaml if needed.Additional options:
5

Verify the installation

Clear the cache and open your application:
Open any page in the browser with the Symfony Web Profiler toolbar visible. You should see a </> icon in the toolbar. Click it to open the Twig Inspector dropdown — if it appears, the bundle is installed correctly.For the full usage walkthrough (enabling the overlay, hovering, clicking), see the Quickstart.

IDE integration

To enable click-to-open in your IDE, set the framework.ide option in your dev framework configuration. The bundle uses Symfony’s standard %%f (file path) and %%l (line number) placeholders.
URL handler examples for common editors:
On macOS and Linux you may need to register the URL scheme handler for your IDE. PhpStorm and VS Code do this automatically when installed. For other editors, consult their documentation.