The PDT project gives you the ability to do PHP development using the Eclipse IDE. It includes many features of the Java editing environment, including syntax highlighting, code templating, perspectives, and file and project wizards.
To install PDT, make sure you have the latest version of Eclipse. Use the built-in software updater to update PDT from the update site. PDT requires the WST subproject, so install WST first if you don't already have it. If you downloaded and installed the J2EE bundle of Eclipse, you already have WST. If you downloaded the Java-only bundle of Eclipse, you must install WST from the Eclipse discovery site.
Figure 1. Installing WST from the Eclipse discovery site
After installing PDT, there are a couple things you might want to set up, especially if you're using PDT and Eclipse on a computer on which you've already been doing some PHP development. The first configuration is the path to the PHP executable. To set this path, open the Preferences window, and in the left pane, expand PHP, then click PHP Executables. In the right pane, you'll see where you can type or browse to the path of your PHP executable file.
Figure 2. Setting up the PHP interpreter
Under PHP in the left pane, click PHP Interpreter, then, specify the version of PHP you're using. The default is PHP V5.
To access the PHP editor, under PHP in the left pane, expand Editor. The PHP editor that comes with PDT includes many features of the Java editor, including syntax highlighting, formatting, code completion, and code templates.
The PHP Functions tab shows the common PHP functions and classes available in your library path. You can search for functions in the list by starting to type in the search box, as shown in Figure 3. Double-click the name on the PHP Functions tab to insert the name into the editor at the current cursor position. You can also use code completion (Ctrl+Space) when typing in the editor to pick from a list of matching functions or templates and insert them.
Figure 3. Searching for PHP functions
The PHP Project tab provides a PHP-centric view of your PHP project by listing the contents of your project split into object types. You see any classes you have defined in your project under Classes and any functions under Functions. Double-click the item on the PHP Project tab to automatically navigate to the item in the editor in which it's found. Figure 4 shows an example of the PHP Project tab with the classes and functions discussed later.
Figure 4. The PHP Project tab
The PHP Explorer shows a list of the projects and files in your workspace. It's consistent with the other project explorers, such as the Java Explorer.