Skip to content

Feature request: Symfony & Twig #25

Description

@Bleksak

Add support for Symfony - routes, views/templates, doctrine

  • routes
  • views/templates
  • doctrine query builder autocompletion
  • twig - routes, components, live components maybe
  • translations - code action to generate? go to definition, go to references
  • something more that i'm forgetting probably

Activity

  1. AJenbo commented on Mar 16, 2026

    @AJenbo
    Contributor

    That would be great, but it's been many years since I worked with either so I'm not sure I could do a very good job of implementing them.

    At minimum I would need good examples and explanations as well as someone to test things. The Symfony docs are pretty good and they are usually less of a spaghetti system then Laravel so there docs should be useful at least.

    Would you be able to help with this?

  2. Bleksak commented on Mar 16, 2026

    @Bleksak
    Author

    yes, i could even write some code if you want, and ideally port it back to mago as you did with laravel

  3. AJenbo commented on Mar 16, 2026

    @AJenbo
    Contributor

    That would be much appreciated.

  4. n0ss1g3n commented on May 8, 2026

    @n0ss1g3n

    @Bleksak if you want a Symfony LSP right now, you can check out Vimfony. But I'd love to see Symfony support in phpantom as well !

  5. AJenbo commented on May 8, 2026

    @AJenbo
    Contributor

    If you can create a demo project similar to https://github.com/AJenbo/phpantom_lsp/tree/main/examples/laravel that would be really helpful.

    Existing tools, especially if they have tests, under MIT license (likeVimfony) are also helpful. But really a valid Symfony implementation of a demo project would be the next best thing to make short of implementing support and sending a PR.

  6. snoweuph commented on Jun 5, 2026

    @snoweuph
  7. devjacjef commented on Jun 5, 2026

    @devjacjef

    I would love if twig was supported on this. The codebase I use has a lot of Twig + Laravel + Legacy PHP and I've been waiting so long to find a LSP that supports all 3. Going to try this LSP at the weekend for a project I am working on.

  8. n0ss1g3n commented on Jun 5, 2026

    @n0ss1g3n

    If you need any help understanding how to find information about some symfony things (Using the built-in console or the xml container file), feel free to ask.

  9. n0ss1g3n commented on Jun 5, 2026

    @n0ss1g3n

    You might also want to take a look at the PHPStorm Symfony plugin.
    The Symfony team shares information about upcoming features of Symfony with Jetbrains to keep Symfony plugin up to date.

    There's for example some special phpstan tags for easier autocompletion : https://www.jetbrains.com/help/phpstorm/symfony-creating-helper-functions.html#hashes

  10. n0ss1g3n commented on Jun 23, 2026

    @n0ss1g3n

    If you want to implement it with php calls at runtime :

    To get routes information :
    php bin/console debug:router --format=json

    To get view/templates information :
    php bin/console debug:twig --format=json, the namespace/path list is in the "loader_path" key.
    (None) means no @something prefix. @!xxx means it is an override directory for the @xxx namespace (my memory might not be accurate on this one).

    Doctrine query builder information :

    1. Get the entities known by doctrine :
      php bin/console doctrine:mapping:info --no-ansi
    2. Get the orm name of those entities
    3. Get the properties of those entities

    twig - routes, components, live components maybe :
    Answer is in the json of the json of the view/templates informations

    translation :
    php bin/console debug:translation en --all --no-ansi
    This one might be a bit complicated. « en » is the locale used to get this information. Not all projects will have the english locale.

  11. n0ss1g3n commented on Jun 27, 2026

    @n0ss1g3n

    @AJenbo I've started an implementation to give you a baseline to make this work.

    Unfortunately, I don't know how to code in Rust, so everything has been done using AI.

    I've tried to respect the existing codebase, using the Laravel implementation as an example/reference.

    The implementation does not run any runtime commands and is in testing on my machine to avoid bugs as much as possible.

    Do you have any instructions or recommendations for me before I open the PR?

    What's working :

    • routes autocomplete
    • form option autocomplete
    • translation autocomplete
    • twig path autocomplete
    • service autocomplete

    All of this is only working in php files. Are you planning on giving autocomplete in yaml/twig files or is it out of scope ?

    For Symfony users some services are defined in yaml files like this :

        services:
            App\BackOffice\Notification\Messaging\AdminNotifierInterface: '@App\BackOffice\Notification\Messaging\NoopAdminNotifier'
    
            App\Test\Doctrine\TestConnectionFactory:
                decorates: 'doctrine.dbal.connection_factory'
                arguments: [ '@.inner']
  12. AJenbo commented on Jun 27, 2026

    @AJenbo
    Contributor

    My only suggestion would be to use https://github.com/twigstan/twigstan as a reference and a source tests (both projects are MIT licensed)

  13. added this to the Backlog milestone on Aug 15, 2026
  14. gaelreyrol commented on Aug 16, 2026

    @gaelreyrol

    It looks like @fabpot is working on a LSP / tree-sitter integration for Symfony: https://github.com/symfony/language-tools

  15. sidux commented on Aug 27, 2026

    @sidux
    Contributor

    The Symfony work is now split into focused pull requests.

    Generic foundations used by Symfony

    Symfony and Doctrine support

    Shared indexing support

    The Symfony-specific stack is intended to merge in numerical order from #397 through #406 after the generic foundations. The indexing fixes can be reviewed independently, with #409 following #408. Generic PHP implementation lenses remain isolated in #393 rather than being bundled into the Symfony scope.

    Every PR includes a Why section and focused validation.

  16. AJenbo commented on Aug 30, 2026

    @AJenbo
    Contributor

    nice work! I'll start reviewing it over the next week's, I'm going to try to make 0.11 a short cycle and then start adding features in following releases

  17. AJenbo commented on Sep 8, 2026

    @AJenbo
    Contributor

    @sidux

    Since a lot of these stack on top of each other it's helpful if you can rebase them as parts lands. Also the sooner the example project can land the better since that allows it to be tracked as things evolve, bonus points for gradually landing each part as part of the PRs that add the support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions