Setting up your workstation for web development
From Joomla! Documentation
Revision as of 23:46, 2 May 2012 by Enav
This article or section is in the process of an expansion or major restructuring. You are welcome to assist in its construction by editing it as well. If this article or section
This article provides detailed instructions for setting up your workstation as a PHP development environment, not only for Joomla! it also should work fine for PHP development in general.
Note There are many possible configurations for doing PHP development environments. Any environment that supports the basic AMP stack (Apache, MySql, PHP) and Subversion should work fine.
Choosing a code editor
The PHP language code represented just by plain text that can be edited with simple text editors like:
- Geany (opensource cross platform text editor)
- Gedit (opensource code editor for linux)
- Notepad++ (opensource code editor for Windows)
- Apple textEditor (Apple's basic text editor)
But when you are about to work in more advanced and complex projects and need some coding assistance there is a handful of development tools called IDEs (Integrated Development Environment) these are some of them:
- Elcipse IDE (opensource cross platform IDE)
- Netbeans IDE (opensource cross platform IDE)
- UltraEdit IDE (closed source cross platform IDE)
- Aptana IDE (opensource cross platform IDE)
To empathize some of the advantages of the use of IDEs over simple text editors we got:
- Some IDEs integrate and/or let you integrate assistive functions to develop code such as code completion, re-factoring, templates, advanced search/replace, syntax check, syntax coloring and more
- Some IDEs can analyze the project as a whole and build a map of relationships between the classes in use in your project giving you the opportunity to explore the project in a more comfortable and coherent way
- Some IDEs can analyse the current file under edition and give you a map of the different variables, functions and classes present on the file as a shortcut to navigate through the content
- Some IDEs integrate and/or let you integrate PHP debugging client under the same tool
- Some IDEs integrate and/or let you integrate several kind of source code revision control clients under the same tool
Some of the advantages of simple text editors are:
- This kind of editor are usually lightweight
- Some of these editors are great to do quick editions
- Some of these editors provide syntax coloring and basic code completion
All these advanced tools facilitate the development of PHP code, debugging, and the integration of other tools like SVN or GIT clients for source code version control under the same IDE, but for this article we are going to focus on how to configure Eclipse IDE for our PHP development environment, feel free to add more editors and document them in the following list.
- How to configure Eclipse IDE for PHP development
- How to configure Netbeans IDE for PHP development
- How to configure UltraEdit IDE for PHP development
Choosing a web server
To develop and test our PHP projects we need to execute the code in a web server capable of interpret PHP code and send the output to our browser, is good to know that we have a nice range of opensource tools to deploy a PHP webservers for our development environment such as:
- XAMPP (Cross platform AMP stack implementation)
- WAMP (AMP stack for Windows)
- LAMP (AMP stack on Linux)
Also there is other commercial closed-source options such as:
- IIS (Microsoft webserver, the PHP and MySQL services got to be installed manually)
All these options for web services can be used for the development of PHP projects, but for this article we are going to focus on how to configure a XAMPP server for our PHP development environment, feel free to add more web servers configuration and document them in the following list.
- How to configure a XAMPP server for PHP development
- How to configure a LAMPP server for PHP development
- How to configure a WAMP server for PHP development
- How to configure an IIS server for PHP development
Choosing a Debugging tool
Debugging tools are quite useful when you are developing a PHP project and you want to study how your code behave step by step on each line execution of your code, also these debugging tools let you see the real values of variables and objects and set new values on the fly for testing purposes, you can also create expression to check the outcome without modify your code.
Old school and hardcore PHP programmers don't fraternize much with these kind of visual tools and they prefer to debug their code the old way using php:var_dump and other methods to display and analyze the output of the PHP code, is up to you what kind of tools you want to implement in your development workflow.
There is several alternatives for PHP debugging, some of these are:
- Xdebug (opensource debugging service for PHP)
- Zend Debugger (commercial debugging service for PHP)
To empathize some of the advantages of the use of this kind of debugging tools we got:
- You can stop (freeze) the execution of your PHP code any time placing a breakpoint
- You can inspect the current value of variables and objects without dumping the content
- You can execute the code step by step all the way from the beginning of the PHP code to the end of it and study how your application behaves under certain circumstances
- You can set or modify the value of variables and object on the fly and see the results of your changes without modify the original code at all
All these options for PHP debugging can be used for the development of PHP projects, but for this article we are going to focus on how to configure Xdebug for our PHP development environment, feel free to add more debugging alternatives and document them in the following list.
Choosing a software versioning and revision control tool
Don't you hate when you are coding and suddenly by accident you just deleted a big chunk of text and there is no backups of that file to restore those important lines of code?, don't you hate when you are working with 2 or more developers in a project and everyone have a different copy of the project then comes the day of merge all those changes in one final project but everything goes wrong or the project does not want to run properly because some one just overwrite your work?, for all this problems and many more exist some nice tools to bring you the solutions you just need, some of these tools are:
- GIT (Is a distributed revision control and source code management)
- SVN (Is a software versioning and revision control system)
All these options for software versioning and revision control can be used for the development of PHP projects, but for this article we are going to focus on how to configure GIT for our PHP development environment, feel free to add more software versioning and revision control alternatives and document them in the following list.