As I wrote in my last blog post, I was surprised about how good Eclipse fits for the development of Symfony2 projects. Long years I have avoided to work with Eclipse if possible. The reason was that the plain IDE was useless for PHP development. Without a lot of plugins the feature set can’t stand the comparison with the other major IDEs (especially PHPStorm). But there are a lot of plugins, a combination of them let you build a really good Symfony2-Development environment.
So lets take a look what I did. As always I would love to hear your comments on everything that could be done better or any plugin you find it worth to install.
First of all you need a Eclipse installation. I have chosen version 3.7.1 of the “Eclipse IDE for JavaScript Web Developers” (http://eclipse.org/downloads). The first plugin to install is yedit a YAML Editor plugin for Eclipse. There are others but I found this one the best of them. To install yedit add the Update-Site (Help->Install new Software) in Eclipse. The URL of the Update-Site is http://dadacoalition.org/yedit.
PHP/Symfony
The next plugins to install are the PDT (PHP Development Tools) and the Symfony2 plugin. Now the bumpy road lies ahead of us. The Symfony2-Plugin is in beta state at the moment and needs a development-build of the PDT to work. So installation can produce “interessting” results in form of errors. For a detailed installation instruction consult the installation page of the project. Because of the dependencies and the development speed things will change frequently.
What will you get installing the plugin? Short answer: A bunch of great little helpers for editing Symfony2 Classes. Here is my favorite list:
- Autocomplete of route-names in Twig-Templates
- Code-Assist of Template-paths
- Code-Assist of Container-Services
- Annotation-Support
- Code-Assist for translations
For a more complete list of features please consult the Projects homepage. Here some screenshots (taken from the projects homepage)
PHP Tool integration
Next step is to get a better PHP Tool integration. As I’m addicted to Tools such PHPUnit, CodeSniffer and others I love to have them integrated directly in the IDE. And thats a thing Eclipse is lacking so far. But as always rescue comes by installing a new plugin. In this case PTI(PHP Tool Integration, http://www.phpsrc.org). The Installation can be done via the Update-Site of the Plugin (http://www.phpsrc.org/eclipse/pti/). The current version brings support for PHPUnit, PHP_CodeSniffer, PHP Depends, PHP Copy/Paste Detector. The development speed slowed down the last months, so if you like the plugin just make sure you send you congratulations to Sven Kiera (Twitter)
After installing the plugin you will have to initially configure it in the preferences (there is a new category PHP Tools there)
After installing and congiguring you get new views for your IDE. In these you can start the tools and can work through the results of them.
WicketShell
Chances are good that you never heard anything about WicketShell, although it is a great plugin after all. WicketShell adds a Console Shell as an Eclipse view. This is pretty useful to execute Symfony-Commandline-Operations or doing other console stuff. This is even more useful if you are using Windows because of the lack of a good console. The development activity of the plugin is low but it is usefull nonetheless. The Update-Site for installation: http://www.wickedshell.net/updatesite
Code-Formatting
The default capabilities of Eclipse/PDT are two basic settings for the idention size and the Tab policy. Compared to the possibilities of Netbeans or PHPStorm this is a shame. Luckily there is a plugin for that PHP Code Formatter: http://de.sourceforge.jp/projects/pdt-tools/. There is no updatesite available at the time of writing this. So you will have to download the plugin file and install it as a file (archive) in the under Help->Install New software. After installing the plugin you can creating code formatting rules that fits your Coding Style (hopefully you have one). This is totaly handy for reformating your sources with the Ctrl+Shift+F Shortcut.
Version Control
Even for the support of a version control system you will have to install a plugin. Sometimes there are more than one for the same VCS (for SVN for example). As I’m working with GIT and Mercurial most of the time, I installed these two plugins:
Git: I use EGit, update-site here: http://download.eclipse.org/egit/updates
Mercurial: I use MercurialEclipse, update-site here: http://cbes.javaforge.com/update
Code Coloring
Maybe you are a fan of strong colors or love dark backgrounds in your Editor windows. If this is the case the Eclipse Color Theme plugin is definitly for you. After installing the plugin from its update-site (http://eclipse-color-theme.github.com/update) you can choose and install from a great set of different themes (http://www.eclipsecolorthemes.org/).
That’s it. That brings Eclipse on par with other IDEs. For some things (DI autocompletion, Annotation support) this installation will beat the others.
The installation still has the general problems of an Eclipse installation. The components should be touched / updated carefully. Better don’t touch then if everything is working. The Symfony2-Plugin is still beta and relies on a development build of the PDT, so any update here can break the IDE. But without this you will get a decent PHP/Symfony2 IDE and some features are really a joy to work with. Will I love it? Most probably not, but it is a good choice for all who doesn’t have the free choice or like Eclipse anyway.