Chapter #2 – Setting the development tools

This is the second chapter of the big “Become a PHP developer guide” brand i started here few days ago.

Read Chapter #1 already? If not, go now, people…

One more thing before i start : Please read the Migration to PHP 5.6 guide before you continue (If you haven’t read it yet). Again, it is important for us to create and maintain a good working environment.

Welcome to the second lesson on “Built to success – PHP developer”.

After we created the infrastructure, we need to set a work environment, which is the IDE with it we will develop our PHP scripts and projects.

There are many IDEs out there, and there are great ones and lousy ones like in any other product or service. But in this guide i am giving you my own settings that i found most suitable for development fast and well performed.

Install JRE

Because eclipse was originally created for JAVA developers, the main structure of Eclipse is based on JAVA. For completing this chapter, you must first install the JRE on you local computer.

The Java Runtime Environment (JRE), also known as Java Runtime, is part of the Java Development Kit (JDK), a set of programming tools for developing Java applications.

I will not start talking about it here, but this installation is mandatory for our working environment stability.

If you want to read more about JRE, and what is it, feel free to go to Oracle website and study.It is a “Nice-to-have” in our case, but hey, i won’t stop you from learning…

We will not start to configure JVM (JAVA Virtual Machine) and other stuff regarding the JAVA environment issues, because we are PHP developers…Focus is everything!

Eclipse IDE

What is “IDE”?

An integrated development environment (IDE) or interactive development environment is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of a source code editor, build automation tools and a debugger.

Originally created for JAVA developers, the eclipse IDE is an open source project, and on it the open community created the PDT, that delivers a PHP Integrated Development Environment framework for the Eclipse platform.

What makes it so good working environment, you ask?

Well, a good programmer know that he/she don’t have to remember all by hard, this is why they invented the Content Assist, that can suggest auto complete methods and language keywords.

Even Zend, the mother of PHP, refer its developers to work with Eclipse IDE. They adopted the environment because they also discovered its benefits.

Zend

Zend

Zend is the most respected company in the online PHP world, and it is contributing to the growth and efficiency of the language.

Zend created the Zend studio platform, that is the complete working environment for PHP developers, and it is actually the best studio i worked with, but the price is too high and the licensing is too strict for me, i prefer my working environment to be affordable and easy to maintenance.

So, i will continue with Zend PDT, the free IDE with all the comfort of Zend support…

I will introduce to you later on some cool features from Zend technologies… Get ready to be hooked.

So, i hope by now you downloaded the Eclipse IDE and it is installed on your computer (Notice:Usually, the installation is unzipping the downloaded zip file to a folder under your root directory, like “c:\eclipse” or something like that).

Create a shortcut on your desktop to the IDE and double-click it…

You will get a pop-up window called “Workspace Launcher”. Each instance of Eclipse IDE have to be related to a workspace, where the projects are located in your hard drive. All projects are open under this workspace, and you can have multiple workspaces and you can switch between workspaces in the IDE.

workspace_launcher

 

We talked about it in the first chapter, our workspace will be our created Dropbox folder, and our localhost will look at our Dropbox folder as our document root. Do not get confused, we are talking about a folder for our IDE, where it will save our workspace preferences, and not our sources.

The workspace path can be on your local drive, or you can point it to be the same Dropbox folder you created. Why is it better to point to local folder and not the Dropbox folder? Simple reason, actually.Your workspece is created under the path you decide and create a “.metadata” folder with the workspace preferences. In older versions, the metadata included some full paths to JAVA_HOME (No need to learn it yet) and other libraries.

The Dropbox folder path is changing, in my case, i have my laptop, there it is on “c:\”, but i have my work computer, there i save my private Dropbox folder under “c:\Ofer”. So, it is kinda annoying when the Eclipse IDE crashes on start because it does not recognize the workspace’s folder on my machine.

Another reason is separated resources and projects, when a developer have several Eclipse instances for different projects/clients. This requires a different workspace folders, because if you make the same folder for all instances, you will end up with same configurations and eventually the same projects in your workspace.

Wrap it all up

So, we have an eclipse to create our scripts and projects, and we already have a web server and database configured and running (Remember Chapter #1?).

At this point you can get to know a little about working with eclipse by creating new Project.

  1. Open Eclipse and open a new project.  newProject
  2. A wizard will open to select what kind of project you want to create. Choose “Local PHP Project” and click “Next”.localProj
  3. Name your project “Temp” and hold. Look at the “Location” field. As default, it will point to your workspace folder as where to save your resources. You want the project will be saved in your Dropbox folder. This is where you should change it to the path to your Dropbox folder.NewLocalProjWiz
  4. A new project will appear to your left sidebar (AKA “The Project Navigator”). In it you can find a project skeleton that includes all the PHP resources available for your convenience as a developer and an empty “index.php” script . Just add there “Echo ‘hello world!’;”.ProjNavigator
  5. Launch XAMPP console and start Apache (The web server, as we know by now).

Remember, your projects is now under your Dropbox folder, so, if you worked it through Chapter #1, when launching the server and go to “http://localhost/Temp” in your browser, you will see the miracle happens and the web page will show you “Hello world!” as its content.

This is it for now. You made it through the second lesson and came closer to becoming a great PHP developer with kick-ass working environment…

 

See you at Chapter #3…

One thought on “Chapter #2 – Setting the development tools

  1. Pingback: Become a PHP developer – Guide | PHP Raxan and Ajax

Leave a Reply

Your email address will not be published. Required fields are marked *

*