Learning Joomla! 3 Extension Development(Third Edition)
上QQ阅读APP看书,第一时间看更新

Tools you need to develop the Joomla! extensions

Obviously you need a computer to develop Joomla! extensions, but the type of computer you choose is completely up to you. There are free open source software for all the major operating systems, but the most popular operating system in the Joomla! community from my observations at Joomla!Day events seems to be Mac, although personally I use Windows, and there are those that use Linux too. When it comes to Joomla! development, there is no advantage of one operating system over another; you should choose whatever you are most comfortable and familiar with.

You will need to set up a local development environment with a web server, PHP and MySQL, however there are many ways of achieving this. XAMPP is quite popular, and it will work on Windows, Mac, and Linux. There are also a lot of alternatives such as MAMP , WAMP , EasyPHP , and Webmatrix , just to name a few. For Joomla! 3, you should make sure that whichever you choose has PHP Version 5.3.1 or greater, and has MySQL Version 5.1 or greater. Apache webserver is most commonly included in these tools, but there is nothing stopping you from using an alternative webserver such as IIS. You could even set up PHP and MySQL manually if you prefer. You could have no local development environment and just work off a live webserver, but I would not recommend this as it's going to be much faster and more convenient for you to have the local environment, and there is no risk of breaking anything on a live site. Most of these software packages such as XAMPP also include a tool to manage your MySQL database called phpMyAdmin .

To test your code, you will need a web browser, and once again you have many to choose from. I personally like Firefox , but many people develop using Chrome , IE or Safari . I really like the Firebug plugin for Firefox which allows you to inspect elements to see what CSS code is being applied, which is really handy for development purposes. All the major browsers now have some kind of similar development tools, so what you choose to use is entirely up to you. Another great feature of Firefox is the error console, which will help you pinpoint JavaScript errors. You can see the Firebug plugin in the bottom-half part of the following screenshot:

When developing Joomla! extensions, you will need a text editor or an Integrated Development Environment (IDE) to edit the source code. If you are just starting out, try a simple text editor such as Notepad++ or Textedit . The main requirements are that the text editor should support the UTF-8 format and should display line numbers. If you plan to do a lot of development, then an IDE is definitely worth learning. The most popular in the Joomla! community are Eclipse and NetBeans . An IDE has some powerful features that make your life easier and can integrate with Subversion or Git to manage version control. They can also allow you to use a builder such as Phing or Ant to automatically create installable packages for your extensions and simultaneously copy the code to multiple development sites, and they can do file comparisons to see what has changed. Another big advantage of an IDE is that you are able to use a debugging tool such as XDebug to set up breakpoints to step through, and inspect code while it is running. I personally use Eclipse, which can be slow when used on older computers, but if you have a fast processor such as an i7, it works great.

The following screenshot demonstrates how to set Notepad++ preferences to use UTF-8 encoding:

The following screenshot shows where you can turn on line numbers in Notepad++.