February 28, 2021
Hot Topics:

10 Powerful PDT Tools, Tips and Tricks for PHP Developers

  • By Jason Gilmore
  • Send Email »
  • More Articles »

The best developers are efficient developers, individuals who have figured out how to write the largest amount of quality code in the shortest possible period of time. One of the easiest ways to become a more efficient developers is by choosing and mastering an integrated development environment (IDE). Of course, exactly which IDE you should use has long been a favorite subject of heated debate. Within the PHP community, however, there's little doubt that the PHP Developer Tools (PDT) framework for Eclipse has emerged as one of the most popular open source development environments. I use PDT and happen to think it a superb solution for rapid PHP development.

In this article I'll share 10 different tools, tips and tricks worthy of consideration if you've recently adopted PDT as your IDE. Of course, we'd love to hear about your own tips, so be sure to add them to the comments section at the bottom of this article!

1. PDT Tip: Configure Zend Framework Code Completion

If you're using the Zend Framework, you logically should take advantage of code completion when using the various Zend Framework classes. To do so, you'll need to add the Zend Framework library directory to your project's PHP include path. Right click on your project within the PDT project explorer, choose the PHP Include Path menu item, and add the library directory path via the Libraries tab. Once added, code completion will be available. Just start typing Zend and then press the Ctrl+Space hotkey to display the completion menu!

Of course this process isn't limited to use solely with the Zend Framework. Follow the same steps to make code completion available for CakePHP, symfony, or any other framework!

2. PDT Tool: Install the Zen Coding Plugin

Hand-coding large amounts of HTML can become a very tedious task -- particularly when you're working with deeply nested elements. For instance, creating an unordered list containing five items, with each item using a bold tag involves either a lot of typing or copying/pasting. I was looking for a faster way to barrel through the creation of these sorts of HTML structures and was lucky enough to find Zen Coding, an incredibly intuitive solution for rapidly generating HTML and CSS. Once the Zen Coding editor plugin (all major editors are supported) is installed, creating the aforementioned list is as simple as typing out the following sequence and pressing the ctrl+e shortcut:


After pressing ctrl+e, the following structure will be generated:

Adding Zen Coding support to PDT is easy, simply install Sergey Chikuyonok's eclipse-zencoding plugin. Just follow the instructions found in the project README, restart PDT, and you can start writing HTML code faster than you ever imagined!

If you're looking for a comprehensive Zen Coding tutorial, check out Zen Coding and the Art of Rapid HTML Authoring.

3. PDT Tip: Take Advantage of PHP Templates

PDT can save you a great deal of typing thanks to the almost 50 PHP code templates made available to the IDE. Use these templates to quickly add common syntactical structures such as PHP classes, switch statements, and block comments. For instance, if you want to create a new PHP class, start typing class and press the ctrl+space hotkey. From the popup menu, choose class - class statement and press return. The following structure will be added to the file:

class class_name {
	function function_name() {

Once added, you'll be able to quickly add the class name and method name as PDT will use placeholders for these values and allow you to type the former and pressing tab to move to the next location.

To view a complete list of available templates, navigate to Window > Preferences > PHP > Editor > Templates. Here you can also further enhance PDT's templating feature by adding your own!

4. PDT Trick: Use the PHP Functions Menu

I've used PHP's date() function more than 1000 times during the past decade, but to this day I can't recall the purpose of the many date formatting arguments it supports. If you can't remember a particular function or the arguments it supports, open the PHP Functions view (Window > Show View > PHP Functions). Unfortunately, a hotkey isn't assigned to this particular view by default, but you can easily add one by navigating to Window > Preferences > General > Keys and then scrolling to Show View (View: PHP Functions).

5. PDT Trick: Integrate a Local PHP Manual

Building upon the previous tip, you'll often need to dig a bit deeper into a function's capabilities, going beyond merely reviewing the function's name and argument signature. You can review a function's manual entry by right clicking on its PHP Functions view listing. The default behavior is to retrieve the page found at www.php.net. You have the option of streamlining this process by telling PDT to instead use a local version of the manual. To use a local version, download the PHP manual (many files version) from http://www.php.net/download-docs.php, and save it to a convenient location on your laptop. Next, open PDT and navigate to Window > Preferences > PHP > PHP Manual. Add the new manual location, making sure to set the File Extension setting to HTML.

Originally published on https://www.developer.com.

Page 1 of 2

This article was originally published on March 8, 2011

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date