Starting project in Eclipse ( pdt ) With Zend Framework (PART-1)

Posted by Unknown on 23 Jan 2013


Introduction

This tutorial describes how to deploy your first PHP application using Zend SDK deployment plugin for Eclipse IDE. It starts with setting up Eclipse to work with Zend deployment, then goes you though enabling project, editing and finally deploying an example application.

Prerequisites

An Eclipse IDE will be needed to further proceed. Any recent Eclipse version is a good choice, although to comfortably write PHP code you'll most likely need separate features, that are not included in Zend SDK deployment support.
Minimum requirement:
  • Eclipse (3.6/3.7)
Recommended, for PHP source code editing support:
  • Eclipse PDT (3.6/3.7)
  • Zend Studio (8.0/9.0)

Installation

Installation details are described in separate wiki document
To install Zend SDK plugin in Eclipse, click Help > Install New Software... from main menu.
In "Work with" field, enter the following URL:
Select "Zend Application Deployment" and click "Finish". Installation will take a moment and ask you to restart Eclipse. After that, you're ready to go!
Note! In order to speed-up the installation process, you may want to uncheck "Contact all update sites during the install to find required software".

Create a project (for example Zend Framework)

You can use an existing project, create new one using your favourite project wizard. Our example uses Zend Framework project wizard available in Zend Studio.
  • Click File > New > Zend Framework (in PDT select PHP Project)
Click finish to create project.

Add Application Deployment Support

  • Right click on the project
  • Select Configure > Add Application Deployment Support
  • The files deployment.xml and deployment.properties will be added to the project contents.
  • Application editor will show up to let you further customize your application.

Modify the deployment descriptor

  • Let's modify some of the project properties, for example project name and version to make them better reflect the real project that we're working on. While editing form fields, the underlying XML files is constantly updated saving user from manipulating XML by hand.
  • Add dependency: Zend Framework
Since our application depends on Zend Framework, we'll also specify this dependency in descriptor. This will save us in future, because before trying to install our app, the server will first check if necessary Zend Framework is available.
Click "Add" and select "Zend Framework Version" dependency:
Our application will have a password-protected admin panel. Usually, we'd have to manually configure the application by changing it's configuration files, or implementing some sort of pre-configuration mechanism. Zend Deployment mechanism simplifies this tedious action.
We'll specify application parameters directly in deployment descriptor, and later during actual deployment, admin will fill in the parameters and our deployment scripts will pick them up and pre-configure the application.
  • Add user name parameter, click "Add Parameter" and fill-in as follows:
Add password parameter, click "Add Parameter" and fill-in as follows:
  • Finally, we want to make use of parameters. During project deployment, we'll store the parameters provided by user in a configuration file, that later can be read by our admin panel.
Application deployment is split into four phases: staging, activation, deactivation and unstaging. Staging and activation take place when installing application, while deactivation and ustaging take place during removal.
Let's perform our configuration after the staging is done- in postStage callback. Double-click 'postStage' to create appropriate script. Since the file doesn't exist yet, you will be asked to create one.
After pressing 'yes', you can specify the details:
Now our package is done. Let's deploy it!

Export a package

  • In the Overview tab, click on “Export as a package”
  • A wizard is displayed including the path to export to.
  • Click Finish
  • The package is ready!

{ 0 comments... read them below or add one }

Post a Comment