If you have enjoyed moving to a dedicated code editor in the previous recipe but want a solution that provides even more integration to perform all of your WordPress plugin development tasks in a single place, an integrated development environment (IDE) such as the free NetBeans platform will be the perfect solution for you. In addition to having all of the core features of a code editor, NetBeans has the ability to constantly parse your code to identify syntax errors and highlight changes made since your last commit or update operation, right in the editor.
It also features built-in Subversion and MySQL clients to be able to commit code changes and manage database records straight from its interface. The NetBeans application is cross-platform, available on the Windows, Mac, and Linux operating systems, and can be quickly configured to work with a local WordPress installation. This recipe explains how to perform these installation and configuration tasks.
1. Download the PHP NetBeans installer for your choice of platform from the NetBeans website http://netbeans.org/downloads/index.html).
2. Install the NetBeans tool by running the installer, selecting all default options, and accepting the license agreement.
3. Launch the NetBeans IDE using the shortcut it created during the installation.
4. Install the latest updates, if applicable, and restart the IDE to run the latest version.
5. Select the File | New Project menu item.
6. Select PHP in the Categories section and PHP Application with Existing Sources in the Projects section.
7. Click on Next.
8. Set the Sources Folder to the location of your local WordPress installation (
c:\WPDev
on Windows, if you followed the previous recipe).9. Specify a Project Name (for example,
WordPress Development Site)
.10. Select PHP 5.3 in the PHP Version field.
11. Check the Put NetBeans metadata into a separate directory option and create a new folder to hold this data (for example,
c:\WPNetBeansData)
.12. Click on Next.
13. Set the Project URL to
http://localhost/
.14. Click on Finish.
15. Once the project is loaded, close the Tasks panel since it will be populated with a long list of to-do tasks that are extracted from the WordPress source code.
16. Using the Projects view, navigate to the
wp-content/plugins
directory of your WordPress installation and double-click on thehello.php
file to see it in the NetBeans editor.17. Search for the keyword function in the file and remove its last letter
n
to see a red exclamation mark displayed in the left margin of the code editor. This indicates that a PHP syntax error was detected.18. Undo this last change.
19. Press the F6 key to launch a web browser session pointing to your local development site.
The NetBeans editor works by creating a project that points to your website's directory structure and loading all files that are found in that location. With its integrated project browser, it is very easy to find and edit multiple plugin files by starting a single tool. NetBeans combines all of the functionality of a dedicated code editor, a Subversion client such as TortoiseSVN, and the phpMyAdmin database administration interface to make it possible to perform all tasks related to WordPress plugin development in a single environment.