When learning about coding and how to code, one of your initial questions will be simply: “Where do I do my coding?” The reality is you can do it in a basic text editor like Notepad on windows, or Gedit on Linux, etc. However, there are many applications, IDEs (Interactive Development Environments), that provide a bunch of extra functionality to make coding easier. Here’s a list of basically all the PHP IDEs:
Our recommendation is Netbeans. Why? Well it’s the one I’ve found to be most popular among Yii developers, plus I’ve tried them all and compared all their features blow for blow, and I found it to be the beast. It has built-in Mercurial support, support for debugging with Xdebug (which we’ll cover in another tutorial, great code completion support, refactoring tools and more.
You can download it here: http://netbeans.org/ . Well, here’s the download page (download the PHP version obviously):
Netbeans is open source. It has many plugins to augment its functionality, and its well-maintained with constant improvements.
This is going to be a short tutorial, and it’s more of a recommendation. But I will share the main things to expect from Netbeans (and most IDEs):
1) Code Completion - what this will do is display menus as you type code to help you complete your code, i.e. offering hints of what you might type next. When coding, it’s not about remembering every function or method, etc, that you may type. It’s about generally knowing what you’re doing. With the internet at your fingertips, it’s all about looking up a solution you know exists (perhaps by reading these tutorials) or even a solution you previously used to remind yourself. Similarly with code completion, you’re given the names of possible solutions based on what you’re typing. The solutions will generally come from the Yii framework powering your application (or your own code). The idea is that the IDE is knowledgeable about all the methods, properties, etc that lie deep within the Yii library code. So you don’t have to worry about remembering it all.
2) Code Hiding - you can expand/collapse blocks of code that you’re not currently working with to make it easier to focus on what you are working with.
3) Code Navigation - Netbeans provides lists of all the methods and properties in your current PHP class, so you can navigate around the code by browsing a simple list of the main (hopefully informationally named) methods/properties/etc.
4) Refactoring - you can do things like change the name of a method everywhere it is used in your code by changing its name in one place. And more. The general idea behind refactoring is that you often come up with more concise ways to code solutions after you’ve already developed a partial solution. Netbeans makes it easy to globally make a change across all your code.
5) Debugging - Debuggin is the process of executing your code in your web browser while your IDE “steps” through the code. That means you can visit your website, and then watch basically an arrow point to each part of the code as it’s executed. What happens is your browser hangs on a white screen, while you watch the sequence of your code execute step by step. This is required tool for all FaceySpacey developers. It allows you to pinpoint where the problem is, rather than see an error page in the browser and wonder where the problem is. I won’t go to deep into debugging right now, but just imagine yourself being able to execute a script, and watch what values are being dealt with in just one block of code in perhaps many blocks of code in the execution without having to worry about those other blocks.
6) Formatting - this is perhaps the most basic feature of any IDE, but a very important one. Netbeans will automatically space and tab words apart from each other in a consistent fashion so your code always is structured similarly and is therefore easier to read.
7) File Browing - Netbeans makes it very easy to navigate your tree of files in your application, and add new files, etc.
Netbeans offers a lot more features, but that should give you an idea of what its purpose is. Get it immediately, and don’t look back.