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
Start the container
Build and start the development container:This builds the Docker image, starts the container, and runs composer install automatically. Install all dependencies
Install both Composer and pnpm dependencies inside the container: Run the tests
Verify your setup is working: Without Docker you need PHP 8.1+ and Composer installed locally. Some Make targets require the container and won’t work in this mode.
Available Make targets
All targets run commands inside the Docker container. The container starts automatically if it isn’t running.
| Target | Description |
|---|
make up | Build and start the container |
make down | Stop and remove the container |
make shell | Open an interactive shell in the container |
make install | Install Composer and pnpm dependencies |
make test | Run all PHPUnit tests (unit + integration) |
make test-coverage | Run tests with code coverage report |
make qa | Run all QA checks (code style + tests) |
make assets | Install pnpm deps and build frontend assets |
make cs-check | Check code style with PHP-CS-Fixer |
make cs-fix | Auto-fix code style with PHP-CS-Fixer |
make phpstan | Run PHPStan static analysis |
make rector | Apply Rector refactoring |
make rector-dry | Run Rector in dry-run mode |
Composer scripts
These scripts run directly with composer inside the container (or locally without Docker):
| Script | Description |
|---|
composer test | Run all PHPUnit tests |
composer test-coverage | Run tests with code coverage |
composer cs-check | Check code style |
composer cs-fix | Auto-fix code style |
composer phpstan | Run static analysis |
composer rector | Apply Rector refactoring |
composer qa | Run 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
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:
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
# Install dependencies
pnpm install
# Production build (minified)
pnpm run build
# Development build (unminified)
pnpm run build:dev
# Watch for changes
pnpm run watch
Asset locations
| Path | Purpose |
|---|
src/Resources/assets/src/*.ts | TypeScript 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