NetBeans provides you a modern slim PHP IDE. Very fast (even in larger projects) and good code completion, file/code/property explorer and excellent HTML/CSS/Javascript support. Subversion and xdebug support works almost out of the box as we will see below. Current version of NetBeans is 6.8. Version 6.9 with a lot of small goodies, ex. ability to detect changes outside NetBeans so far had been a bit of a mystery, ability to refactor inline css codes to external such etc., is around the corner (eta early June 2010, currently on beta status and beta is quite stable). As a last note about version 6.9, since the installation is made to version specific folders, if you want to give 6.9beta a run you can do so without interfering with your 6.8 setup.

NetBeans provides you a modern slim PHP IDE. Very fast (even in larger projects) and good code completion, file/code/property explorer and excellent HTML/CSS/Javascript support. Subversion and xdebug support works almost out of the box as we will see below. Current version of NetBeans is 6.8. Version 6.9 with a lot of small goodies, ex. ability to detect changes outside NetBeans so far had been a bit of a mystery, ability to refactor inline css codes to external such etc., is around the corner (eta early June 2010, currently on beta status and beta is quite stable). As a last note about version 6.9, since the installation is made to version specific folders, if you want to give 6.9beta a run you can do so without interfering with your 6.8 setup.

−

==Installation and initial configuration of NetBeans==

+

==Installation==

+

===Installation on Windows===

Prerequisite: to be able to install and run NetBeans you would need Java 6 or 5. If you don't have that installed, download it from http://java.sun.com/javase/downloads/widget/jdk6.jsp.

Prerequisite: to be able to install and run NetBeans you would need Java 6 or 5. If you don't have that installed, download it from http://java.sun.com/javase/downloads/widget/jdk6.jsp.

# Download NetBeans (http://netbeans.org/downloads/index.html) and make sure to download the PHP version. The installation is straight forward and amounts to clicking through the installation wizard which defaults to correct and workable values.

# Download NetBeans (http://netbeans.org/downloads/index.html) and make sure to download the PHP version. The installation is straight forward and amounts to clicking through the installation wizard which defaults to correct and workable values.

+

+

===Installation on Linux: Ubuntu 10.04===

+

+

# Open the terminal and install Netbeans (Java) version with the following command:

# Your first run after installation will install the auto-update plugin. Please do restart after installing the plugin.

# Your first run after installation will install the auto-update plugin. Please do restart after installing the plugin.

# Your second run will find a number of updates which you are advised to install.

# Your second run will find a number of updates which you are advised to install.

Line 39:

Line 50:

## Its now time to press the Finish button and create the project.

## Its now time to press the Finish button and create the project.

# Although NetBeans succeeds detecting where the PHP interpreter is located and thereby also xdebug, lets make sure that this is correct by going to Tools > Options menu and click to the PHP section (among the top horizontal bar of icons). In the General tab we should be able to verify that the PHP 5 Interpreter is the correct one and that the Debugger Port option contains the same value as the xdebug.remote_port parameter in the PHP ini file of the interpreter referred to.

# Although NetBeans succeeds detecting where the PHP interpreter is located and thereby also xdebug, lets make sure that this is correct by going to Tools > Options menu and click to the PHP section (among the top horizontal bar of icons). In the General tab we should be able to verify that the PHP 5 Interpreter is the correct one and that the Debugger Port option contains the same value as the xdebug.remote_port parameter in the PHP ini file of the interpreter referred to.

−

## For those who've followed the instructions at http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development to update php.ini with <pre>set xdebug.remote_port=10000</pre>You need to go to Tools->Options and set the Debugger port to 10000 to match.

+

## For those who've followed the instructions at http://docs.joomla.org/Setting_up_your_workstation_for_Joomla!_development to update php.ini with <pre>set xdebug.remote_port=10000</pre>You need to go to Tools->Options->PHP->General and set the Debugger Port to 10000 to match.

# With this behind us let us create our index.php file and put a simple statement, ex. echo "hello netbeans". Press F6 and the project should run by invoking index.php either in your default browser or one you would be able to configure in Tools > Options > General > Web Browser. With the given example, this should output "hello netbeans" in your browser.

# With this behind us let us create our index.php file and put a simple statement, ex. echo "hello netbeans". Press F6 and the project should run by invoking index.php either in your default browser or one you would be able to configure in Tools > Options > General > Web Browser. With the given example, this should output "hello netbeans" in your browser.

Line 82:

Line 93:

* On all things related to PHP development in NetBeans refer to: http://netbeans.org/kb/trails/php.html

* On all things related to PHP development in NetBeans refer to: http://netbeans.org/kb/trails/php.html

* If you have difficulty knowing the version of xdebug to install refer to: http://www.xdebug.org/find-binary.php

* If you have difficulty knowing the version of xdebug to install refer to: http://www.xdebug.org/find-binary.php

+

* Netbeans video, its really designed for working with Joomla and the Bug Squad with SVN: http://www.vimeo.com/11981229.

+

* How to do extension development from almost scratch with NetBeans and Joomla 1.6:

+

** [http://vimeo.com/13045800 Part 1].

+

** [http://www.vimeo.com/13167176 Part 2]

+

* A NetBeans Plugin with all the necessary files to create a joomla 2.5 component http://plugins.netbeans.org/plugin/45881/joomlamodule

Contents

Introduction

A brief overview of how to setup the PHP edition of NetBeans follows. You would still need to consult Setting up your workstation for Joomla! development to learn about setting up your environment for Joomla! development. For the sake of brevity and not to "reinvent the wheel" we will provide references to further readings wherever we deem various topics are treated to a satisfactory extent elsewhere.

Notes

NetBeans here and after refer to the PHP edition of NetBeans only.

The following applies to all flavors of Windows and the steps should be similar or the same for other OS.

In many of the cases there are several ways of achieving your goal, and the coverage here is just a guideline for a new beginner and doesn't claim on being exhaustive.

About NetBeans

NetBeans provides you a modern slim PHP IDE. Very fast (even in larger projects) and good code completion, file/code/property explorer and excellent HTML/CSS/Javascript support. Subversion and xdebug support works almost out of the box as we will see below. Current version of NetBeans is 6.8. Version 6.9 with a lot of small goodies, ex. ability to detect changes outside NetBeans so far had been a bit of a mystery, ability to refactor inline css codes to external such etc., is around the corner (eta early June 2010, currently on beta status and beta is quite stable). As a last note about version 6.9, since the installation is made to version specific folders, if you want to give 6.9beta a run you can do so without interfering with your 6.8 setup.

Installation

Installation on Windows

Download NetBeans (http://netbeans.org/downloads/index.html) and make sure to download the PHP version. The installation is straight forward and amounts to clicking through the installation wizard which defaults to correct and workable values.

Installation on Linux: Ubuntu 10.04

Open the terminal and install Netbeans (Java) version with the following command:

Sources Folder - where the files created within the project will be located. Although NetBeans makes an attempt to locate the server DocumentRoot, it normally fails and defaults to Apaches default htdocs, which means if you have reconfigured DocumentRoot in your httpd.conf it will not be able to point it out for you, and you will need to point out the location manually as follows. Go to your DocumentRoot folder by choosing Browse and in your DocumentRoot folder create the project folder hellonb, select the folder and click Open.

Put NetBeans metadata into a separate directory - NetBeans creates a folder named nbproject containing project specific IDE settings and metadata of the project to be created. If you are working with a project in which you are about to checkout from svn, as we will see below, having this folder in your project folder is not a desired option as it eventually will be included in your patch export. One way of not having nbproject in such exports is to relocate nbproject from its default location, the project folder. This is done by simply checking this checkbox and pointing out where the nbproject folder should be located, outside your project folder. Another method will be described below.

In the next page of the wizard make sure that the Project URL is correct, in this case http://localhost/hellonb/, depending on your setup.

Its now time to press the Finish button and create the project.

Although NetBeans succeeds detecting where the PHP interpreter is located and thereby also xdebug, lets make sure that this is correct by going to Tools > Options menu and click to the PHP section (among the top horizontal bar of icons). In the General tab we should be able to verify that the PHP 5 Interpreter is the correct one and that the Debugger Port option contains the same value as the xdebug.remote_port parameter in the PHP ini file of the interpreter referred to.

You need to go to Tools->Options->PHP->General and set the Debugger Port to 10000 to match.

With this behind us let us create our index.php file and put a simple statement, ex. echo "hello netbeans". Press F6 and the project should run by invoking index.php either in your default browser or one you would be able to configure in Tools > Options > General > Web Browser. With the given example, this should output "hello netbeans" in your browser.

Subversion setup

In this part we will see how easy it is to work with an SVN repository for the purpose of checking out, creating patches, apply patches and update repository.

Create a new project of the type "PHP Application" according to the above outline

Check if NetBeans created an index.php file in the Source Files directory (it's located right there under the 'Projects' tab). If so, delete it before you start the checkout. If you don't it might break the checkout process.

Click Next and NetBeans will connect to the SVN repository and ask you to provide:

Repository folder(s) to checkout from in the repository which should remain unchanged, being "development/trunk" as it was included in the Repository URL. If the field is empty for some reason provide development/trunk.

Local Folder - Browse and point out your current project folder

Uncheck the "Scan for NetBeans project" checkbox and click Next

Checking out the trunk can take some minutes to finish and you will see the task status on the right side of the status bar.

Now that the joomla code base is checked out its time to install Joomla!. In order to run Joomla! the installation folder needs to be removed or at least renamed. Now this creates a catch-22 as deleting the folder or changing it will result in being considered as actual change for which patch will be generated, and if we don't change it we can't run Joomla!. The solution here is to make NetBeans ignore the installation folder from here and on. Unfortunately NetBeans doesn't allow us to ignore files that are already in the svn repository. /If you know of a better way than using external tools such as Tortoise SVN for this purpose please edit and put it here/

If you didn't choose to relocate the nbproject directory while creating the project, let us now make sure that the SVN client ignores it, i.e. assure that its not included in any patch export.

In your Files pane find the folder nbproject and right click on it

Choose the Subversion > Ignore menu and once the folder is ignored it is colored gray.

Let us now make a dummy change to see how to deal with the various steps of creating a patch works.

Open components/com_content/content.php and make a change, ex. by inserting a comment. Once we have saved our change you will see that files that

the line where the change is done is highlighted with blue to the left of the edit screen

filenames are colored with blue

containing folders of changed files are highlighted with a blue badge.

Lets now assume that our change is a solution to a tracker we would like to submit it as a patch. In NetBeans you will be able to do that at several levels, either patch extracted from the file itself only, or at an upper level up to the project level. To do that:

in the Projects or Files pane, click on the folder or file you want to be the position from which all changes will be extracted as patch.

Go to Team > Export Diff Patch... menu and give the location of the patch file to be generated and click OK.

Applying patches is analogus and all features related to SVN are found under Team or Team > Subversion menu.