PHP - - By Arno Slatius

4 Features That Make Me Choose NuSphere PhpED

In the last survey on the best PHP IDE for 2014, my longtime favorite PhpED was missing. I didn’t act on it then, but what better way to spread the love than to devote an article to it.

I’ve spent the first part of my programming career without a real IDE. UltraEdit was meeting most of my needs. At a certain point you start to realize you’re missing out on something and the quest for a real IDE begins.
For quite some time I was relatively happy with NetBeans; after some time though, I did find myself fighting it on too many occasions. I again concluded that it was time to move on. Having a historical hate for Eclipse (we had a serious misunderstanding back at version 3 dot something from which I still haven’t recovered) meant I had to test the commercial IDEs.

Why I chose PhpED

Speed, overview and simplicity. That sums it up, really. There are a few things that mattered for me, speed-wise; switching projects, getting code suggestions and fast debugging. Overview is something that I want because my projects get quite complex at times. An IDE like Eclipse overwhelms me with way too many options and buttons which I hardly ever use, keep it simple please. I believe I found my requirements and more in PhpED…

1. Project wizard

The project wizard will help you set up your project like you want it; simple local project, local server or remote server. Run on web server and/or CLI. Set up the directories, code page, PHP/HTML/CSS versions and finally checking to see if the debugger is working. It’ll be quite specific on how to fix issues or offer to fix them should there be any.

PhpED_project_wizzard.PNG

2. Autocomplete

All the normal things are present when it comes to editing code: dynamic syntax highlighting for multiple languages, variable highlighting, fast searching and more. The code suggestion is instant; the IDE presents the possibilities that match the start that you typed. When you find what you wanted and your code is documented using PHPDoc, then it’ll show that while you’re entering your variables.

PhpED_code_insight.png

In the example above, you can perhaps spot something that can be improved; it fails to show multiline comments of the documentation. This is good to get a simple overview of the function call, but quite often you document something for a reason and you want to see it all.

3. Debugging

PhpED comes with the DBG extension for debugging. The debugger installs as a PHP module. The project wizard will automatically install the module for you if you’re running a local server. For a remote server, you’ll have to do it yourself. Again, the wizard is very helpful here on how to do this, suggesting the correct paths and file content for your server. PhpED will automatically listen for incoming debug connections and helps you get the connection through firewalls and routers, should that be necessary.

The debugger has all the features we can expect; single stepping, running to or from cursor position. Breakpoints can have additional conditions which are evaluated every time they are touched. The debugger can be started from the IDE with a ‘Run in debugger’ but can also be triggered to start at any time by just adding the DBGSESSID parameter to the request. This parameter is also saved as a session cookie so that every consequent request can be debugged automatically.

The debugger has sped up my development workflow on many occasions. The insight into the local and global variables is superb. The entire call stack is traced and all variables at every call in the stack are available.

PhpED_debugger_views.PNG

The debugger is also capable of profiling memory, SQL and execution. The memory profiling was added recently. It gives you an insight to your code and exactly how much memory it’s using where, an insight which might surprise you.

PhpED_memory_profiler.PNG

The line profiler will show you where that time waiting for a page all went. It’ll be grouped and aggregated by module or function to find the critical points of your code.

PhpED_Line_profiler.PNG

Your SQL code is of course all traceable. From connection time to setup commands and queries, every part of the SQL interaction is logged in detail.

PhpED_SQL_profiler.PNG

The example here was done using PDO, note how the query parameters aren’t logged. If you’ve ever tried to optimize SQL queries you’ll know that you want the exact query to be able to run an EXPLAIN properly. Some room for improvement, I’d say.

4. Overview

PhpED features a function called code navigator which shows the structure of the file you’re editing at any given moment. There is a quick search at the top of it allowing you to jump to specific parts within the file. The view adapts to the current file and is also capable of filtering out the different parts, should it contain more than one language. The bottom PHP/HTML/CSS and JS tabs allow you to switch between the individual sections.

PhpED_code_navigator.png

The recent addition for SCSS support was welcome as well. Hugo Giraudel has written quite a bit about it here on SitePoint and I think most of us see the benefits. I like SCSS most for its structured approach. I was promised that support for LESS language additions is coming soon as well; the sooner the better.

And there’s more…

The list of features is long. I’m sure I’m not using them all. A few versions ago PhpED also started supporting PHP frameworks. This worked out very well because it is now aware of the relations between controllers and views. At the bottom of your editing window it’ll show tabs for the (partial) views you’re using in the current file or for the controller related to your view.

PhpED_mvc.PNG

With framework support also came the possibility to do URL mapping; quite often you can’t run or debug the file you’re editing. The framework you’re using has its own URL manager that maps a controller to a URL for instance. You can tell PhpED how to map the files in your structure to a URL which it can run. It’ll then open the correct URL if you press Run. If you’re using a controller with multiple actions it’ll even show a pop-up asking which action you want to start.

Is it perfect?

Will any IDE ever be? As a developer you’re constantly evolving; discovering new possibilities and you hope your IDE can keep up with you. This IDE, on the other hand, has surprised me with new features at times. I do make it a habit to check out other IDEs every now and then to make sure I don’t miss out on something. So far I haven’t see any major things that made me seriously consider switching.

For me, there’s one real annoyance; the color picker. It’s like a time machine back to Windows 95. Not sensitive to the code at hand, doesn’t do RGB() codes or HSL(), not capable of opacity, not user friendly, don’t even bother trying it.

There are some other nice-to-haves that I’ve seen in other IDEs, but those don’t tip the balance yet. Among the features that might be nice additions are Composer integration, a spelling checker and perhaps plugins.

I made some suggestions to the PhpED team some time ago and got quick feedback on it. I was also invited to become a beta tester for PhpED, and the suggested features made it into the product – that at least gives the impression you’re taken seriously when you suggest something.

Conclusion

I only showed some of the features of PhpED here. This selection, though, is what makes PhpED a winner to me. This IDE has definitely helped me become a more agile developer, but like always, everything is relative; I’m sure you have the same feelings about your IDE.

Are you using PhpED? Or do you use another IDE that does an even better job? Tell us about your experiences.

Sponsors