PHP and Smarty: What IDE?

This week I’ve decided to use Smarty for a personal project. I’ve previously been leery of using a template engine with PHP because PHP is a template engine. You can embed code in what are otherwise HTML documents.

Why Smarty?

But this week I’ve come around to the Smarty way of thinking for several reasons.

  1. It has excellent documentation. Every function is documented (as far as I can tell) and there are sections on relevant advanced topics. As regular readers will know, I have been critical of projects lacking documentation;
  2. It’s compiled to PHP anyway so apart from an initial “compile”, there is performance cost for using it.
  3. It simplifies a lot of common task like odd-even table row styling, rendering combo boxes with a particular item selected, etc;
  4. There are extensive variable modifiers;
  5. There is very little magic going on. By “magic” I basically mean auto-loading and other things that introduce code you don’t necessarily expect. Smarty is very straightforward and is obviously designed for high-performance use, which I really appreciate;
  6. Smarty is extensible with it’s plugin architecture and input and output filters.

Ok, so decision made: use Smarty. Now what?

Where are the Tools?

I still haven’t found a PHP IDE that I’m comfortable with. In part, this is probably due to using Intellij IDEA, which as far as I’m concerned is by far the best Java IDE out there. So much so that many Visual Studio users consider Resharper a “must have” extension for .Net development. Resharper and Intellij are both by Jetbrains. Resharper adds a lot of the refactoring tools that Intellij has to Visual Studio.

So what am I looking for?

  1. Syntax highlighting;
  2. Code completion;
  3. Being able to navigate to and from templates, plugins, etc; and
  4. Some form of validation (eg plugin file naming).

The code completion and syntax highlighting should, at a minimum, apply to PHP, HTML, Javascript and CSS. Ideally it would also include good jQuery support but that’s just a nice-to-have.

This isn’t an exhaustive review of these tools, merely an overview based on a fairly narrow set of requirements.

Eclipse PDT

I have never quite grokked the Eclipse way of thinking. The whole perspectives thing where your whole IDE changes when you are, say, debugging never sat right with me. To each their own I guess. You also have the well-known malaise known as Eclipse plugin hell.

Still, I’ve tried it a couple of times and it’s OK but it doesn’t understand Smarty templates. There is a project to add Smarty support to Eclipse but it seems to be abandoned or dead and doesn’t seem to work with Eclipse 3.5.


For PHP I’ve used Netbeans far more than Eclipse. I can’t give you a concrete reason for this other than to say that I just found it less bloated and more straightforward. But unfortunately there is no Smarty support and it appears there are no plans to add it.

Komodo Edit

I only tried the free version (Komodo IDE is commercial) but it has no Smarty support. I’ve read some people rave about this tool. Personally I found it uninspiring.


There are lot of things I like about PhpEd but it is commercial. It has one glaring problem though: You can’t change the font size menus and other UI components. You can change the editing pane but the rest is derived from the OS DPI settings. Apparently this is because of the framework PhpEd is written in from what I could gather from the forums. Still, that’s a problem. There’s a huge difference between a 24” 1920x1200 display and a 15” laptop display that’s also 1920x1200. Changing the DPI setting in the OS is fraught with problems so changing it is not always a viable option.

That being said, I am generally most impressed with this IDE out of all the others. The price (US$210) is that high but it can be a lot for a personal project considering how much you can get for free elsewhere.

One thing I don’t like is that you have to buy a Windows or a Linux version. Why? Compare this to Intellij. You simply buy a license and you can use it on Windows, Mac or Linux. Why should it matter if I want to change my OS? It’s also a greatly different version (3.3.3 on Linux, 5.8 on Windows). Is there a difference? Is Linux lagging behind?

PhpEd does understand Smarty templates though so it has to get a big plus for that.

CodeLobster PHP

I’ve been testing Code Lobster for a few days. It’s an interesting product. What I like about it:

  • It’s lightweight at under 10 megs in size;
  • The UI is modern-looking and snappy;
  • It has support for Smarty, Joomla, Wordpress, CodeIgniter, Drupal and jQuery;
  • It is quite cheap and you only pay for those plugins you use, basically.

That being said, I did come up with a few things that need some more work.

  • No “live” search. I’ve been spoilt by Intellij on this one. This is where the cursor moves as you type so you can stop typing as soon as you get to where you want. I consider this a “must have” feature of any editor. The venerable search box needs to be retired;
  • The search/replace functionality was a bit awkward in how it searches multiple files. It doesn’t list all the matches that you can just click on. Searching a subfolder is awkward;
  • Making changes to the filesystem externally requires a manual ‘Reload Project’. Something like Netbeans or Intellij will just find changed files quickly;
  • There doesn’t seem to be a way of moving files around within the IDE;
  • Some of the auto-formatting takes a bit of getting used to. For example, you type an opening brace and it advances automatically to the next line and indents. That’s not bad. You just need to get used to it.

I can’t say this is an exhaustive list and I’m not saying it’s a bad product. Overall I like it. It’s just a bit rough around the edges.


In the last month, Jetbrains has announced the development of Web IDE in standard and PHP editions. You can download an Early Access Preview release and try it out. To me this is the Great White Hope of the PHP IDE market because I have such enormous respect for Intellij’s code editor, which to me is the most important part of any IDE.

I’ve had a brief look at the PHP support and it still seems like there is a long way to go but I’ll certainly keep an eye on it. Based on Jetbrain’s track record, I have a lot of hope for this one but as Eclipse has shown, making a good Java IDE is different to making a good PHP IDE and as soon as you try to do everything you end up being good at nothing. I usually describe this condition as “doing everything badly”.

Also, it seems Jetbrains will be rolling this functionality into the fully-featured Intellij IDEA 9 (Maia) release so if you happen to get that version anyway (which I will) you’ll get it for “free”.

The good thing about Intellij is that it’s equally usable on Mac, Linux and Windows and you can use your license for any of those. It’s out of the box functionality comes with Subversion integration and pretty much everything you need out of the box. For me, this sure beats the plugin hell of Eclipse like figuring out which Subversion plugin to use (Subclipse or Subversive).

It’s the Little Things

There are plenty of people who happily develop using a text editor such as Textmate, Notepad++, Vim or Emacs. You can but there’s nothing like an IDE that supports left-clicking on a class to open the other class. Or an IDE that understands what framework you use (eg understanding Spring is particularly useful for a Java IDE).

Several of the programs I looked at did things like have code completion for HTML, CSS and Javascript to the point that you could click Ctrl+space and get a list of values for a CSS property. All of those things are useful.

One of the things that really impresses me about Intellij is the little ways the editing makes your life easier. This can be as simple as you type “mysql_query(“ and it inserts a closing parenthesis for you. Lots of programs do that but in Intellij if you then type a closing parenthesis, it moves you cursor after the automatic one. No spurious parenthesis is added and I don’t have to navigate over the automatic one with cursor keys or mouse. This speeds up how fast you can type and helps not break your flow.

That may seem like a small thing but there are literally hundreds of things like that in Intellij to the point that I now look for them in anything else I use, for better or for worse.


I guess the downside of using a dynamic language like PHP is that it’s harder to do anything like validation and navigation.

For my money, at this point in time, I would have to say that PhpEd is the best of the bunch if Smarty is important to you but keep an eye on Web IDE/Intellij IDEA when the next version is released by the end of the year (Q4 2009).


Sean said...

Komodo Edit has smarty support... the actual answer to your search is don't use Smarty, PHP is a templating language already, why put another one on top of it?

9neo said...

confirm Komodo Edit has smarty support

Philly said...

Aptana already has more support for it than any other ever will. It is eclipse based but has more of a "Web 2.0" aspect than Zend or Eclipse.

Although Sean is right, it is kind of redundant.

spekkionu said...

As of version 1.5, Aptana Studio has smarty support.
It is another eclipse based IDE though and comes with most of the problems that entails.

William Shields said...

Bah! Aptana. I knew there was one I'd forgotten. Doh! I will check it out.

KVron said...

I'm using PHPEd and I'm happy with it. After I found a promo code the final price was at $180 bucks.

The only drawback is that if you have many projects in the workspace, it will take some time to read all files.

One thing I like about PHPEd is that I don't have to create a full project to edit a single php file.

Anonymous said...

NetBeans has Smarty support. It is a small plugin download from the plugin page on the NetBeans web site.

Andrew Toan said...

I like PHPeD best, especially it's hot-keys. it's awesome
By the way, thanks for your post

iTXByyRkmfwHrML6IKQ0puIhIR6RCw-- said...

Take a look at UltraEdit/UEStudio. It's more of a general-purpose IDE, but the PHP support is getting better with each release. I believe they added proper PHP debugging with XDebug in the latest version. Even without the PHP-specific features, it's a really great programmer's tool which features a ton of those small things like automatic brackets, basic code completion, etc. It's not free but does have a 45-day free trial.

Anonymous said...

I like PHPEd. PHPEd is many times faster that all those bloated IDEs written in java.
Code Explorer in PHPEd is the most valuable thing for big projects.

Anonymous said...

PHP Designer is another Awesome PHP IDE.

Anonymous said...

My choice is Codelobster PHP Edition with special Smarty plug-in.

Anonymous said...

I personally have to choose PhpStorm by jetbeans it also has full smarty support!

Anonymous said...

Netbeans now has smarty support.

ron said...

Bluefish has PHP and smarty syntax highlighting.
also html,css.c,c++ the list goes on and on.

Post a Comment