NetBeans as an IDE for PHP

Laptop

This environment is free, fast, cross-platform, and understands PHP language well. It is pleasant to write PHP code in it, because it has all the necessary tools for this purpose – highlighting, completion from all connected files, PHP class browser, pop-up documentation on standard functions and so on. At the same time, it is not just a text editor. NetBeans knows how to download and upload files to remote servers via FTP and SFTP, has an advanced SQL terminal and fully automates work with SVN or CVS.

Below is how and why I chose NetBeans for myself and my team. Also discussed are a few other decent editors and IDEs for PHP that can be useful in certain circumstances: Vim, JEdit, Eclipse PDT, Komodo IDE.

Choosing an IDE for PHP

There used to be a standard answer to the question of which IDE to do a PHP project in – ZendStudio. Of course, it was paid, but you understand, it was not a problem for anyone:)

Unfortunately, Zend got tired of pulling the burden of developing the original IDE. The current version of ZendStudio is just Eclipse with the Zend logo and the PDT (PHP Development Tools) add-on. On the one hand, it is nice that you can download Eclipse and install this set of plugins for free. On the other hand, Eclipse turned out to be a voracious behemoth compared to the old ZendStudio. It requires more memory, more CPU and draws its glamorous windows much slower.

Many people will say – “It’s nothing like that, it’s not critical on any modern computer, and Eclipse works fine for me”. But for our company it is very critical. The fact is that in our firm, developers sit on thin clients (Sun Ray). In fact, they all work on the same computer. Project managers, CFO and admin also sit on it. A dozen and a half Firefox and a dozen OpenOffice applications are running simultaneously. In such an environment, running just two Eclipse instances leads to a noticeable slowdown for all users. And we need to launch about ten instances.

Of course, we know the recipe – buy a more powerful server. But it’s a shame to spend money, because ZendStudio worked perfectly well in this environment, while PDT has no new “magic” features compared to ZendStudio.

Another disadvantage of Eclipse PDT, which made us give up on it completely, is its inability to SSH using keys. In our company, access to virtual machines where projects are uploaded is done exclusively by keys. This completely solves such common problems as the problem of a fired programmer who forgot to change his password, the problem of a password written down on a piece of paper stuck on the monitor, the problem of a forgotten password and so on. Naturally, we have automated generation of the key and putting it on the virtual machine, and it saves admin’s time. Anyway, we were not going to give up access by public key just because Eclipse doesn’t know how to do it.

As a temporary solution, we switched to Vim. With the addition of a few plugins and tweaking of certain parameters, writing PHP in Vim is quite convenient. (There is an excellent article on turning Vim into a powerful PHP editor).

Naturally, you could forget about the system resource problem forever. A console editor in terms of memory and CPU consumption is just a holiday. But there were quite a few drawbacks in other areas.

First of all, Vim is not an IDE after all, but a text editor. It knows nothing about the fact that the text you are writing is a PHP program, it knows nothing about the fact that you store the source code in SVN. Accordingly, it is not as intelligent as a real IDE, ctags don’t always understand where a function or method is described. You have to constantly remember that after editing you still have to pour the files into SVN using console commands. The lack of a visual diff interface is noticeable. Each problem on its own is a small thing for a real hardcore programmer, but all together they noticeably reduce productivity.

Secondly, Vim is a very specific editor. You need to learn it. Only those who have already used Vi can understand the depth of this phrase:) Yes, in a couple of weeks a novice developer will learn all the commands that are needed in everyday work. But after all, those couple weeks could have been spent learning more necessary things, or just making money.

A side problem that grows out of the specificity of Vim is constant errors when switching to other programs. A developer periodically needs to write reports, use e-mail, i.e. edit texts in other text editors. As a result, before each action, the fingers freeze for a split second, and the brain frantically tries to understand what to press now – +s or :w. This is annoying and reduces productivity.