Nov
07
2011
--

How to build a great Eclipse-Environment for Symfony2-Development

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.

flattr this!

Nov
04
2011
--

The state of Symfony2 support in IDEs

I have developed a lot with Symfony2 in the last months. During this time I switched my development environment a lot too find the tools that fit my workflow as good as possible. Now we have a stable release of Symfony2 available it is time to take a look at the Symfony2-Support of my favorite PHP-IDEs.

Netbeans

Years ago Eclipse was my main IDE for PHP development. I switched to Netbeans with the version 6.5 because it was faster, more stable and got symfony 1 support in one of the 6.x versions. I never looked back. It is fast, stable and has a lot of cool features like PHPUnit-Support or the awesome code-formatter. The symfony 1 support is good, I loved to use the command-line runner and the switching between views and controllers. The PHP support is exellent and supports PHP 5.3. But there is no special support for Symfony2 projects available at the moment. I started a feature request some month ago but there is nothing new here. For a long time there was no Twig-Support either. This can be solved by installing a Plugin but it is sometime a bit buggy and unstable.

PHPStorm

I felt in love with PHPStorm when it was released in Version 1. It is even faster than Netbeans and has all features you need. Debugging-Support is pretty good, PHPUnit is integrated, Good Code-Formatting is available, PHP 5.3 is supported. The lookup of classes and files is fast and convinient. Twig is supported out of the box in the current stable version. All in all it is a great IDE to develop PHP-Projects. There is no special Symfony2 support at the moment. For me the great JavaScript- and CSS-Support is a big bonus, as I develop a lot of code with backbone.js and other JS-Stuff these days. PHPStorm isn’t free but available for reasonable prices. I never regret that I bought a license.

Eclipse

Honestly I was surprised when I checked back the PHP-/Symfony2 support of Eclipse. Two month ago I started to recheck the option to switch back to Eclipse. I was pretty surprised that there are some nice features for Symfony2 developers waiting to be discovered in Eclipse. With some additional plugins you will get a really good Symfony2-IDE. I will write a blog-post about how to setup this as soon as possible (update. Here it is: “How to build a great Eclipse-Environment for Symfony2-Development“). The highlight is definetly the Symfony2 Eclipse-Plugin. It enhance Eclipse to the most advanced Symfony2 features so far. Here are some of them:

  • Autocomplete of route-names in Twig-Templates
  • Code-Assist of Template-paths
  • Code-Assist of Container-Services
  • Annotation-Support
  • Code-Assist for translations

I still don’t like the IDE itself. It takes lang to get used to it. You have to install a lot of plugins to ge a good feature set. Most of the time you will end in a plugin hell where some plugins only work with Eclipse version x another only with version y. In the end I always had more than one Eclipse-Installations (For PHP-Development, for Java-Development, for Flex-Development…). The PHP Support in general is good but the development is done pretty much out of the view of the community.

PHPEdit

As I blogged some time ago, PHPEdit is a capable PHP IDE. It has the most advaned symfony 1 support of any IDE on the market, but this is limited on symfony 1. There was a survey some days ago about what support for Symfony2 is needed, so the makers of PHPEdit started to work on it but there is nothing ready at the moment. Even Twig is not supported at the moment. As I’m using MAC OSX for private projects and Windows at work I need an IDE that supports both platforms. PHPEdit though is only available for Windows. PHPEdit isn’t free but the pricing is ok for what you will get.

Editors

There are other alternatives too. Some do not use fullfledged IDEs for developing. There are some really cool editors out there. I’m a long-time-user of Textmate but the development nearly stopped and the development of the Version 2 is promised for years now. It is only available on MAC OSX. The best multi-platform alternatives I found are Sublime Text 2 and redcar. Both are really cool. I like Sublime Text 2 most. As TextMate it can enhanced via Bundles, it is small and lightweight.

flattr this!

Apr
14
2011
--

Netbeans-Codetemplates for Symfony2

As I’m working with Netbeans when developing Symfony2-Applications I created some Code Templates and Shortcuts to work more effective with Netbeans and Symfony2. If you are interessted you can download the Settingsfile and import it to your Netbeans installation. There is a Symfony 1.x and Symfony2 version available.

You can get it here: http://www.symfony-zone.com/wordpress/netbeans/

If you miss a template just send me feedback

Apr
05
2009
--

The best Symfony IDE: PHPEdit

If you think about the best IDE you will probably think about eclipse with the PDT-Plugin, Netbeans or Kommodo. None of them has special support for the Symfony-Framework. As I wrote in an earlier post I’m using eclipse for my daily work. With some enhancements it is a pretty good IDE for Symfony-Development. Netbeans catched up with the last releases an there is a special Symfony-Support planned in one of the future releases.

Last week there was a new release of the Windows-PHP-IDE PHPEdit. Since Version 3.2 there is an excellent Symfony support in this IDE.  A bunch of features makes the development with Symfony a lot more productive. I couldn’t resist and took a deeper look at this software. It was the first time that I used PHPEdit an I’m surprised on how good it is.

Wizards

PHPEdit has a lot of wizards for creating Symfony-Projects and different Symfony artifacts (i.e. modules, actions…). For developers who dont know all of the symfony command line tasks and all of their parameters, these wizards are a great help.

Project Wizard Command Wizards

Commands

PHPEdit installs a plugin that allows the IDE to get information about all tasks of the current project. The context menu of the project is file-sensitive. So you will get other tasks in the context menu when clicking on a application than clicking on a module or project. All Symfony tasks are available via context menu. Most of them with an upcoming wizard in which you can set the parameters by mouse clicks

Symfony Tasks

Code Completion and Editor

The Editor has everything you can think of and support for all neccessary file formats (i.e. YAML) are included. Code-Folding,Line-Numbers, Smart Idention and others are available. Plus you have a great IntelliSense support. The Editor knows even the Symfony-Framework functions of the classes. You can jump between Actions and View-Template what is solving one of the most annoying problems if you are working on a large project and have a lot of action.class.php files open.

Jump between Action and template IntelliSense

Conclusion

The makers of PHPEdit did a wunderful job. The symfony support is how I it should be in every IDE :-)

Beside of this Framework-Specific features there is all you need for PHP-Development. A good PHP-Editor with IntelliSense and PHP-Debugging, Project management, everything is on board and pretty good. The only drawback is that PHPEdit is not freely available. It has a commercial license starting with 89.- Euros for the basic feature edition. If you are not using windows another drawback is that PHPEdit is only available for windows.

I’m still surprised why I never used this IDE before because it has everything you need for PHP development. Maybe it was because of its commercial license. For now it is the best Symfony IDE. The Framework-Support is outstanding. Lets see how the planned Symfony-Support in Netbeans can compete with this.

Book Mark it->del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Windows Live | Tailrank | Furl | Netscape | Yahoo | BlinkList