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.

Prerequisites

Before you begin, make sure you have the following installed:
  • Docker and Docker Compose (recommended path)
  • PHP 8.1+ and Composer (required for the non-Docker path)
  • pnpm (for building frontend assets)

Setup

Available Make targets

All targets run commands inside the Docker container. The container starts automatically if it isn’t running.
TargetDescription
make upBuild and start the container
make downStop and remove the container
make shellOpen an interactive shell in the container
make installInstall Composer and pnpm dependencies
make testRun all PHPUnit tests (unit + integration)
make test-coverageRun tests with code coverage report
make qaRun all QA checks (code style + tests)
make assetsInstall pnpm deps and build frontend assets
make cs-checkCheck code style with PHP-CS-Fixer
make cs-fixAuto-fix code style with PHP-CS-Fixer
make phpstanRun PHPStan static analysis
make rectorApply Rector refactoring
make rector-dryRun Rector in dry-run mode

Composer scripts

These scripts run directly with composer inside the container (or locally without Docker):
ScriptDescription
composer testRun all PHPUnit tests
composer test-coverageRun tests with code coverage
composer cs-checkCheck code style
composer cs-fixAuto-fix code style
composer phpstanRun static analysis
composer rectorApply Rector refactoring
composer qaRun all quality checks

Running tests

The bundle has 150+ tests targeting 90%+ code coverage. CI runs the full matrix across PHP 8.1–8.5 and Symfony 6.4, 7.0, 8.0.
# Run all tests
composer test

# Run tests with coverage report
composer test-coverage

# Open coverage report in browser
open coverage/index.html

Test structure

tests/
├── NowoTwigInspectorBundleTest.php   # Bundle class tests
├── BoxDrawingsTest.php               # Box drawings utility tests
├── DependencyInjection/              # Extension tests
├── Controller/                       # Controller tests
├── DataCollector/                    # Data collector tests
└── Twig/                             # Twig extension tests

Code quality tools

The bundle uses three tools to maintain code quality:
  • PHP-CS-Fixer — enforces PSR-12 code style (config: .php-cs-fixer.dist.php)
  • PHPStan — static analysis
  • Rector — automated refactoring
Run all checks at once:
composer qa
# or
make qa

Building frontend assets

The bundle ships TypeScript and SCSS assets compiled with Vite.
# Install pnpm deps and build for production
make assets

# Build in development mode (unminified)
make assets-dev

# Watch for changes during development
make assets-watch

Asset locations

PathPurpose
src/Resources/assets/src/*.tsTypeScript source — compiled by Vite
src/Resources/views/assets/dist/Build output — used by the collector Twig template
src/Resources/public/assets/Distributable assets — copied to host project with assets:install
Main output files in src/Resources/views/assets/dist/:
  • index.min.js — bundled TypeScript (IIFE)
  • style.min.css — compiled SCSS

CI/CD

GitHub Actions run on every push and pull request:
  • Tests — PHP 8.1–8.5 × Symfony 6.4, 7.0, 8.0 matrix
  • Code style — PHP-CS-Fixer; auto-fix on push to main/master
  • Coverage — 90% minimum enforced in CI
  • Assets — TypeScript and SCSS build verified
  • Dependabot — automated dependency update PRs

Build docs developers (and LLMs) love