Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nowo-tech/TwigInspectorBundle/llms.txt

Use this file to discover all available pages before exploring further.

The bundle includes three independent demo applications — one for each supported Symfony version. Each runs with FrankenPHP and Caddy inside Docker and can be started independently.
The demo/ folder is not included when you install the bundle via Composer. It exists only in the source repository. To run the demos, clone the repository first.

Demo applications

DemoDirectoryDefault port
Symfony 6.4demo/symfony6/8001
Symfony 7.0demo/symfony7/8001
Symfony 8.0demo/symfony8/8001
Each demo includes:
  • Independent docker-compose.yml for easy setup
  • Complete test suite to verify bundle integration
  • Example controller and Twig templates
  • Web Profiler integration
  • 100% code coverage for demo code
To run multiple demos at once, set a different PORT in each demo’s .env file (for example, 8006, 8007, 8008).

Starting a demo

1

Start the container and install dependencies

From the bundle root:
make -C demo/symfony6 up
This builds the image, installs Composer dependencies, clears the Symfony cache, and starts the server.
2

Open the demo

Navigate to http://localhost:8001 in your browser.The Twig Inspector toolbar appears at the bottom of the page.
Alternatively, use docker-compose directly:
cd demo/symfony6
docker-compose up -d
docker-compose exec php composer install

Makefile helpers

You can also use the demo/ Makefile to manage all demos from one place:
cd demo

# Start each demo
make up-symfony6
make up-symfony7
make up-symfony8

# Install dependencies
make install-symfony6
make install-symfony7
make install-symfony8

Running demo tests

Each demo has its own test suite with code coverage:
cd demo

# Run tests for each demo
make test-symfony6
make test-symfony7
make test-symfony8

# Run with coverage
make test-coverage-symfony6
make test-coverage-symfony7
make test-coverage-symfony8

# Run coverage for all demos
make test-coverage-all
Or run directly inside a demo directory:
cd demo/symfony8
docker-compose exec php composer test
docker-compose exec php composer test-coverage

FrankenPHP configuration

Each demo runs FrankenPHP (Caddy + PHP in a single container) with two Caddyfile configurations:
AspectDevelopment (default)Production
Worker modeOff — one PHP process per requestOn — workers keep app in memory
Twig cacheOff (twig.cache: false)On (default)
OPcache revalidationEvery requestDefault interval
HTTP cache headersno-store, no-cacheOmitted
APP_ENVdevprod
The demos run in development mode by default. The Docker entrypoint detects APP_ENV=dev and copies Caddyfile.dev (no worker, cache-busting headers) over the default Caddyfile before starting FrankenPHP.

Development Caddyfile

{
  skip_install_trust
}

:80 {
  root * /app/public
  encode zstd br gzip
  header Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
  header Pragma "no-cache"
  php_server
}
Do not add a worker directive inside php_server in the dev Caddyfile. With worker mode enabled, template changes won’t appear until the workers are restarted.

Production Caddyfile

{
  skip_install_trust
}

:80 {
  root * /app/public
  encode zstd br gzip
  php_server {
    worker /app/public/index.php
  }
}
To run a demo in production mode, set APP_ENV=prod and APP_DEBUG=0 in the container environment and restart:
docker-compose restart
# or from the bundle root:
make -C demo/symfony8 restart

Troubleshooting

  • Verify worker mode is off in the active Caddyfile (Caddyfile.dev has no worker inside php_server).
  • Check that config/packages/dev/twig.yaml sets twig.cache: false.
  • Check that docker/php-dev.ini is mounted and sets opcache.revalidate_freq=0.
  • Restart the container after changing the Caddyfile: docker-compose restart or make -C demo/symfony8 restart.
  • Hard-refresh the browser (Ctrl+Shift+R) or try a private window.
  • Confirm APP_ENV=dev and APP_DEBUG=1 are set in the container.
  • Ensure WebProfilerBundle, DebugBundle, and NowoTwigInspectorBundle are enabled for dev in config/bundles.php.
  • Clear the Symfony cache:
    docker-compose exec php php bin/console cache:clear
    # or
    make -C demo/symfony8 cache-clear
    
The Makefile runs composer install and cache:clear in one-off containers before starting the server, then waits for an HTTP response on the configured port. Check that:
  • The port in .env (default PORT=8001) is not already in use.
  • The container started successfully: docker-compose logs php.
  • Required env vars such as APP_SECRET are set.
The Caddyfile is read when FrankenPHP starts. Restart the container after any changes:
docker-compose restart
# or
make -C demo/symfony8 restart
In dev mode, the entrypoint copies Caddyfile.dev over the default. Make sure you edited Caddyfile.dev and that it is mounted correctly.

Build docs developers (and LLMs) love