<!-- Parent: ../AGENTS.md -->
<!-- Generated: 2026-07-02 | Updated: 2026-07-02 -->

# Twig

## Purpose
Custom Twig extensions exposing PHP helpers to templates.

## Key Files
| File | Description |
|------|-------------|
| `AppExtension.php` | Registers the `file_exists(path)` Twig function, which checks `DOCUMENT_ROOT . path` on disk. Used in templates to conditionally include optional assets (e.g. a product image that may not exist) |

## For AI Agents

### Working In This Directory
- Registered via the `twig.extension` tag in `config/services.yaml`.
- `file_exists()` resolves paths against `$_SERVER['DOCUMENT_ROOT']`, i.e. the `public/` web root — pass web-absolute paths like `/assets/product/xyz.webp`.
- Add new template helpers here as `TwigFunction`/`TwigFilter` entries; keep them thin (delegate real logic to services/entities).

## Dependencies

### Internal
- Used across `templates/` (notably product/image includes).

### External
- Twig 3 (`AbstractExtension`, `TwigFunction`).

<!-- MANUAL: -->
