Saturday, March 10, 2007

PHP: Using phpEclipse

The universe works in very strange ways. It’s almost as if some benevolent force guides things, and in the grand scheme of things, fate and events work together like cogs in a large machine. Seemingly unrelated events come together to affect the going ons of unconnected scenarios. Call it divine intervention, call it fate, call it whatever, but events do have significance, even if their apparent worth is not visible on the surface.

For example, I have been working on a PHP based project for the past few weeks. One of the main hang-ups I have had is with finding a decent development environment. I typically base my judgment on IDE’s by a benchmark standard of what did the ‘ole Borland Turbo IDE’s offer back in the late 80’s and early 90’s. So things like debugging with the ability to step through line by line, while seeing the change in variables, color highlighting, and with scope awareness become very important. Since my migration to Eclipse in the recent months, I’ve now gotten to a point where other features have become necessary as well, such as Unit Testing capabilities right at the tip of my finger. My current issue was that while there are tons of IDE’s for PHP out in the wild, none of them offered the features that I need to be productive as a developer. Or at least, they don’t offer them in a way that I find useful. That or they charge, and since I’m a lone developer, I have absolutely no intention of purchasing software, especially when it’s for a free environment.

So, after weeks of searching, I settled on the Eclipse PHP Development Tools project (PDT). I need to emphasize the word settle, because it didn’t do the things I need. Its scope awareness was incredibly limited, and as a result its code completion capabilities were equally limited, had no unit test capabilities, and the debugger failed to work after several different configuration changes.

So, it is ironic that my answer came during EclipseCon 2007. I gave two presentations on BIRT this year, which seemed to go over pretty well. I had intended to go see the presentations about PDT to see if maybe there were some configurations or extensions to make it a little more useful, and to see if what the roadmap was going to be. However, fate intervened. Attending my day long BIRT tutorial was one of the developers of the phpEclipse project. It turns out, his attendance was mutually beneficial, he got to learn the basics of BIRT, and after the class, and he offered to talk to me about phpEclipse.

The install packages recommended to me are as follows:

-EasyEclipse 1.2.11 (phpEclipse does not support Eclipse 3.2 just yet)

-XAMPPLite 1.5.2 (The debugger doesn’t support newer versions just yet)

-dbg-2.13.1

I would also recommend going with SimpleTest for PHP Unit testing. I tried to get phpUnit2 to work, however the older version of PHP that is installed with XAMPPLIte does not support it.

Installation is fairly straight forward. Install EasyEclipse per its instructions. Install XAMPPLite per its instructions. Then, follow the steps here to get the debugger to work. Then, follow the instructions for installing SimpleTest and you are good to go.

There are a few limitations to this installation. First, it doesn’t seem to support debugging from within Eclipse. You have to run the application from a web browser with the module you are debugging started. This is kind of annoying, but still a step up from the broken debugger in PDT. Other than that, I can’t complain


.

Figure 1. Code Completion



Figure 2. Unit Testing


Figure 3. Debugging, with variables, for online PHP applications

No comments: