Symfony Plugin

Compatible with: IntelliJ IDEA PhpStorm
11.06.2017
2 135 782
Symfony Plugin Documentation | Doc on GitHub | Donate
Install
  • Activate plugin per project in "File -> Settings -> Languages & Framework -> PHP -> Symfony" or use auto configuration notification
  • (Required) Install PHP Annotations
  • (Optional) Configure a default project connection in "Remote Hosts Access / Remote Hosts" to enable support for remote files in plugin settings
  • (Optional) Ignore Symfony "cache" directory because of duplicate classes "Settings -> Project -> Directories"
  • (Optional) Install PHP Toolbox
  • (Optional) To support XLIFF translations add "*.xlf" / "*.xliff" to XML "Editor" -> "File Types"
Features: Version

This plugin supports Symfony 2 and 3

Dependency Injection Container
  • References for services in ContainerInterface::get()
  • Detect ContainerInterface::get() result type
  • References for services, tags, events, methods, ... inside yaml, xml and php
  • Indexer to provide live editing without a compiled container
  • Tagged class indexer
Doctrine
  • ORM QueryBuilder support, including chaining and nested methods
  • References and TypeProvider for doctrine getRepository
  • TypeProvider for EntityRepository::find/findOneBy/findAll/findBy
  • Field and relations resolving and annotation and yaml
Templates/Twig
  • Template names in all file references
  • Provide Template implements and extends goto on linemarker
  • Assets file references like javascript, stylesheets and more
  • Support @Template annotations
  • Trans and transchoice support with annotator, quickquick and translation extraction action
  • References for block names (completion back since PhpStorm8)
  • Variable TypeProvider similar to php with several scopes and providers like docblocks, controller, actions, template inclusion, ...
  • Macro implements goto on linemarker
  • Filter, Function, Macro and Extension support
Forms
  • References for form types
  • Form field name references on data_class
  • References for form options, extension, ...
Routing
  • References for UrlGenerator::generate() related calls
  • Autocomplete route name in twig templates
  • Go to for routing name methods
  • CodeFolding to display real route uri instead of its name
  • Route parameter completion
Other
  • Annotator which notice unknown route, template, service, assets, ...
  • Several stub indexer to provide some live generation provider in replacement for compiled container
  • Linemarker and "Related File" to provide possible goto targets and controller action
  • Search Everywhere support and custom search for only Symfony related Symbols "Navigate > Symfony Symbol"
  • Bridge for PHP Annotations to support annotation related stuff
  • Dotenv and Docker environments variable extraction for DIC parameter
Related Plugins Contributors

Download plugin

Recent change notes

0.14.x: PhpStorm 2017.1+
0.13.x: PhpStorm 2016.3.1 (no support)
0.12.x: PhpStorm 2016.1 (no support)
0.11.x: PhpStorm 8, 9, 10 (no support)
0.10.x: PhpStorm 7 (no support)
0.9.x: PhpStorm 6 (no support)

0.14.146
  • Reworked compiled container parser to support aliases extraction more safety for Symfony 3.3 private service debugger #618 #943
  • Fix type cast error in voter role extraction #941
  • Fix npe in service call visiting of yaml files #942
  • Fix when using a classname as service id in a routing.yml plugin is mistakenly reporting the method as of missing in Symfony 3.3 #940
  • The inner service of a decorator is always private #908
  • Add Twig variable collector for parameter of a given macro scope
  • Provide extension point a Twig variable collector
  • Dropping ContainerInterface::get usage service linemarker
  • Service indexer should known "_defaults" values of Symfony 3.3 dic component #947
  • Add parameter parser for Kernel::getKernelParameters #950
  • Add "controller.service_arguments" and new yaml service keys completion of Symfony 3.3
  • Service argument inspection must respect _default configuration #948
  • Service generator for YAML files extract indent from file scope #533 #374 #362 #736
  • Action generator menu should also display service generator for yaml files and reduce visibility for valid file scope
0.14.145
  • Reduce blacklist of all file indexes; only ending with "Test" blocks processing now #897
  • Fix translation domain name extraction on empty filename #927
  • Provide ternary and better string value detection for form getParent and getExtendedType
  • Globally support string value resolve for class constant
0.14.144
  • Migrate MethodSignatureTypeProvider to PhpTypeProvider3; prevent cross plugin issue #926 #792
0.14.143
  • Add Twig form_theme indexer and provide targets in linemarker #920
  • ContainerInterface::get doesn't resolve on multiple parameter; drop parameter length check #916
  • Move PHP Annotation plugin `de.espend.idea.php.annotation` from soft to hard dependency to drop duplicate code usages #448
  • Use new PhpTypeProvider3 and replace deprecated usages in Container::get, ObjectManager::get, EventDispatcherInterface::dispatch #792
  • Refactoring of Twig macro logic, provide tests, use indexer #924
  • Add completion for Twig macros after DOT element for "import as" function #924
  • Drop regex from Twig set variable collector
  • Migrate Doctrine type provider to PhpTypeProvider3 implementation #792
  • Refactoring of ObjectManager::findBy* references and support more possible repository usages #925 #898
0.14.142
  • Implement environment variables references for %env(*) on .env and Docker files #910
  • Add Twig trans and transchoice tag support for translation keys #459
0.14.141
  • Parameter Hints must not be provided if plugin is not enabled #896
  • Fix cache folder detection in project auto configuration process #810 @20uf
  • Add navigate to Twig "include" file references #889 and use lazy value provider for better performance #809
  • Support of resname attribute in xlf trans-unit tag #913
  • Fix pattern for Yaml method "calls" #755 and implement named services support
  • Provide parameter type hint for xml and yaml "call" tags
0.14.140
  • Add class navigation for named yaml service keys of Symfony 3.3 #902
  • Add Parameter Hints for YAML and XML service arguments and dropping caret text overlay #896
0.13.139
  • Support granted strings in $attributes parameter of VoterInterface:vote foreach and in_array
  • Fix no description for an intention #891
  • Sort service instance suggest on project usage #890
  • Note: Last PhpStorm 2016.3.x release
0.13.138
  • Use intention for Twig key creation, drop redundant warnings #443
  • Fix roles completing/goto not working with array call #886
  • Add support for translations placeholder in Twig and PHP #631 #528
  • Fix routing path parameter completion in Twig; use newly literal lexer element and drop regular expression for route name extractio
  • Ignore interpolated strings in Twig "path" / "trans" annotator and inspections #884
  • Fix incorrect resolving of Routes with too many underscores on new __invoke controller action in annotations #881
  • Drop regular expression for trans filter in Twig, trust and use lexer #877, #814, #716
  • Support absolute urls in profiler #880
0.13.137
  • Fix npe in route indexing #874
  • Fix parameter autocomplete double percentages #871
  • Add support for isGranted in Twig and php on security.yaml, Voter::voteOnAttribute and Voter::supports #431
  • Add Twig filters autocompletion for filter tag #878
  • Replace hasReferencesInSearchScope which too slow for Twig variable extraction #859 #809
  • Support much more Twig render template pattern like array_merge for controller variables extraction
  • Fix possible npe in container annotator because of empty xml tag value
  • Wrong xml service instances should be more visible so move from weak to warning highlight
  • Migrate Twig translation annotator to inspection; drop possible memory leaks with a popover bridge #832
  • Add a persistent Twig translation annotator to create keys in all known domains #443
0.13.136
  • Support SensioFrameworkExtraBundle @Route annotation for indexer #828
  • Add else and elseif to Twig references tag whitelist; fix autocompletion on constant twig macro #869
  • Implement support for PSR-11 containers #867
  • Add inspection for xml and yaml constants in dic container
  • Replace deprecated api usages
0.13.135
  • Add global template navigation for xml strings and provide template name completion for "template" attributes #803
  • Linemarker collectors are not instance safe, load lazy values internally #846
  • Support class constant in QueryBuilder::from(Entity::class) #824
  • Make yaml service id visitor case insensitive for class names #847
  • Fix "Missing Parameter" warning for parameters set via environment variables #852
  • Add twig test navigation #860
  • Fix Twig missing asset if variable in declaration #854
  • Use getBlockPrefix instead of override deprecated getName #812 @Koc
  • Optimize Twig clickable function pattern #850
  • Add brace insert handler for Twig functions with string parameter detection #864
  • Add support for class constant in Doctrine repositoryClass on annotation metadata #857
  • Dropping weak route name annotator for php files
  • Fix possible npe in variable type extraction #822
0.13.134
  • Fix ConfigLineMarkerProvider.getTreeSignatures must not return null #846
  • Support yaml "tags" shortcut syntax for service container #849
  • Support optional class for named services #847
  • Support new yaml factory syntax #841
  • Fix Doctrine autocomplete not working for getRepository(Entity::class) #824
  • Save last user selected service generator output format and reuse this value on dialog init #829
0.12.133 / 0.13.133
  • PhpStorm 2016.3.1: Make compatible with new Deployment API @Leneshka-jb #826
  • Code cleanup and Java8 language migrations
0.12.132
  • Support more OptionsResolver options method parameter for references #821
  • Add decorates linemarker for yaml and xml container files
  • Service ids should be autocompleted for decorates #834
  • Add PhpStorm 2016.3 / 2016.3.1 travis environment
0.12.131
  • Disable Twig icon provider; performance issue? #809
  • Support new IF_TAG, SET_TAG tokens for Twig function pattern and fix Twig class constant usages
  • Twig class constant string need to be slash escaped
  • Add references for 'argument type="constant"' inside container services
  • Drop some old PhpStorm / Intellij api workarounds
  • Drop all Yaml scalar value workarounds for service and parameter pattern
  • Fix no autocomplete for SVG assets #753
  • Add form placeholder options to translatable value
  • Provide route name completion in routes using the RedirectController #386, also support template names for TemplateController
  • Add {% endtrans %} and {% endtranschoice %} to autocomplete in Twig templates #599
  • Add XLIFF navigation and translation generation if "*.xlf" / "*.xliff" extension is defined as XmlFile #479, #712
  • Add PHP validator translation references for constraint message, ExecutionContextInterface and ConstraintViolationBuilderInterface
0.12.130
  • Add indexer for template usages in annotations #773
  • Add scope for template index to reduce variable extraction and improve performance #800
  • Template usages now also support function scope
0.12.129
  • Fix navigation for bundle files on linux based system, increase path limit for child path iteration #803
0.12.128
  • Decouple Twig namespace loading and provide more default namespace which work without a compiled container #784 #654
  • Add recursive and directory limit for per Twig path visitor #800
  • Add icon provider for Twig template files for extends and implementations
  • Dropping PhpStorm8 type class constant api workaround
0.12.127
  • Profiler should support http urls as data source #798
  • Profiler in now configurable in plugins settings #798
  • Fix app_dev.php urls in profiler #540, #522
  • Add xml completion, navigation and linemarker for Doctrine 2.5 "Embeddables" #471
0.12.126
  • Fix empty PSI elements should not be passed to createDescriptor in container case sensitivity inspection #788
  • Support public property for form field mapping and dropping custom Doctrine field mapping its part of PropertyAccess component #786
  • Fix "Cannot resolve symbol" for factory service regression and drop deprecated getVariant references for factory method completion #791
  • Add linemarker provider for decorated services with lazy definition navigation
  • Replace timer for caret listener with executor and future pattern #785
  • Add linemarker for config tree builder root definition in [security,config]*.yml files and provide navigation for key itself #793
  • Fix subscriber method creation type hint class was not imported and fix possible memory leak because of PsiElement references

open full changelog

General usage instructions

Note that the plugin uses the app/cache/dev/appDevDebugProjectContainer.xml file to know services' class, so this file has to exists and/or be up to date :-) Also note that you need the latest PHPStorm EAP build, download at http://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program