Symfony for VS Code
This extension aims to help developing Symfony2+ projects, by showing services and routes of your current project, and provide autocompletion support with these datas.
It was created by TheNouillet.
This extension add a new view, the Symfony Debug View, to visualize the status of your project container and routes. With this, you can :
- know which controller action is binded to a route
- know which class is binded to a service
- see all services aliases
This extension also enable autocompletion in YAML files to reference services.
How does it works ?
To detect Symfony projects, this extension rely on
composer.json files with
symfony/lts as one of its dependencies.
composer.json file is supposed to be at the root of your Symfony project.
When the project is detected, it simply uses the
debug:router console commands to hydrate the views and autocompletions.
This extension contributes the following settings:
symfony-vscode.showConsoleErrors: Set this to false if you don't want to be annoyed by the extension everytime command calls fails.
symfony-vscode.phpPath: the path of the PHP executable.
symfony-vscode.consolePath: when the console is somewhere else than
app/console for Symfony 2), override this setting.
symfony-vscode.showAsseticRoutes: By default, the route view doesn't show routes generated by AsseticBundle. Set this to true if you want to see them.
symfony-vscode.detectCwd: By default, the extension guess the root directory of your Symfony project to execute console commands from. Set this to false if you don't want that.
symfony-vscode.servicesFilters: A list of regexs to filter out services to improve autocompletion pertinence.
Q: I run my Symfony project on Docker. How do I configure the extension ?
A: You have to override the PHP executable path, and disable the root directory auto-detection, like this :
"symfony-vscode.phpPath": "docker exec my_container_id /bin/sh -c 'cd /path/to/symfony && /usr/bin/php \"$@\"' -- "
See the changelog for releases notes.