Small, awkward and looking for love: Delphi for PHP 2.0
Dreams of past Windows glory
Review The intent behind Delphi for PHP from CodeGear, last month acquired by Embarcadero Technologies, is clear: to provide an integrated development environment for PHP that matches the speed of development regular Delphi offers for Windows applications.
First released in February 2007, the initial version fell far short of the goal, being buggy and under-documented. I've had a chance to get to grips with Version 2.0, and while CodeGear has added some refinements there remains a ways to go.
Delphi for PHP is based on a third-party product, qstudio from Qadram software, though it now appears to be its only incarnation, and features a Windows-only IDE along with a PHP 5 class library called VCL for PHP.
This component library is an open source project on SourceForge though it appears to have little use outside Delphi for PHP. The link with CodeGear's better-known Delphi for Windows is tenuous: it does not share the same IDE, and the language itself is of course PHP, and nothing to do with Delphi's Pascal. That said, the IDE is superficially similar, and existing Delphi users are meant to feel at home.
The Delphi for PHP installer sets up a complete PHP test environment, including a local Apache 2 and the Nusphere debug listener. You can use it as a basic PHP IDE with the ability to set breakpoints and step through code. The editor in version 2.0 is improved, with code folding, syntax checking and automatic source formatting. The IDE also offers a profiler that times each line of code. That said, the real value of the product is in rapid development with the visual component library (VCL) .
Full PHP environment, tenuous links to the better-known Delphi
You can drag components onto a visual form designer, and set properties and handle events through an object inspector. There are also database components, including Database, Datasource and Query, which support data-aware controls such as a DBGrid as well as standard items like edit controls, labels and checkboxes. New in version 2.0, the Xinha HTML editor is also included, enabling instant HTML editing for users.
Although there are a generous range of controls on offer, making full use of them is a challenge thanks to the sketchy documentation. This has improved since version 1.0, but remains inadequate. The sample applications are rudimentary. The quality of the VCL for PHP is uneven. That's partly due to the inclusion of components from various sources (another example is the Qooxdoo Ajax framework used for the DBGrid), and partly because even in version 2.0 the product still seems rushed, with TODO comments scattered liberally through the library.
A snag with the first Delphi for PHP was the difficulty in mixing HTML and PHP code in a form, thanks to the way the VCL works. Each component is a class that dumps its contents to output at runtime. The layout of controls on a page is stored in a separate XML resource file, which is loaded as part of the initialization sequence.
Delphi for PHP 2.0 includes a new unit called a templated form, which does let you add HTML code directly. Even so, an application written in Delphi for PHP is heavily hooked into the VCL for PHP, and code will not be easy to migrate to any other framework.
Concerns over the quality of the VCL for PHP, and whether it has a long-term future, might deter those considering major projects using this product. Perhaps it is more suitable for applications that are small, quick and simple, a role it could fill nicely if only the documentation and tutorials were improved.
Debugging with Nusphere debug listener
Finally, it is a shame that the IDE is Windows-only; it would make sense for CodeGear to do what it has done with JBuilder and move Delphi for PHP to Eclipse. Maybe this will come in time with Embarcadero, given CodeGear was rather stretched for resources as the unwanted subsidiary of Borland.
This has the feel of a product with good potential, but under-resourced by its developers. There are better PHP libraries out there, such as Zend Technologies' Framework, which leaves CodeGear's product occupying a small and awkward niche.®