Skip to content

Add support for XDebug native path mapping for compiled templates #4697

Description

@stof

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions