twigphp / twigphp/Twig

Add support for XDebug native path mapping for compiled templates

Open
#4,697 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
8.4k
Forks
1.3k
Avg merge
1d 13h
Merged PRs (30d)
37

Description

Xdebug 3.5.0-alpha is shipping support for native path mapping.

Twig templates are a perfect use case for this feature, which would allow developers to define breakpoints on the Twig files and have XDebug map those to compiled templates.

See https://xdebug.org/announcements/2025-10-07 for the annoucement and https://xdebug.org/funding/001-native-path-mapping for the project description (useful until the documentation is updated to include that new feature).

We should explore how Twig could integrate support for this feature, generating Xdebug path mapping files when compiling templates.
Given that the mapping files cannot be in the Twig cache to be discovered directly, this will likely need some kind of opt-in. And you might not want to generate such files on production servers where XDebug won't be used (especially given that the Twig use case involves mapping line ranges, which can generate big files)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Xdebug native path mapping announcement and project description, then trace Twig's template compilation flow to identify where mapping files could be generated. Define the opt-in behavior and ensure the completed work covers development use without requiring mapping files on production servers.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.