Zend Studio the leading integrated development environment for PHP Web applications, maximizes developer productivity by allowing you to develop & maintain.
Zend Server is a web application server for running and also managing PHP applications. Basically Zend Server was built-in application monitoring, application problem diagnostics, caching and optimization capabilities and a Web-based administrator console.Zend Framework is an open source, object oriented web application framework for PHP 5. Zend Framework often called a ‘component library’, because it has many loosely coupled components that you can use more or less independently.
1.Create a PHP project
- To start working in Zend Studio, you should at first create a new PHP project which will contain the files for your application.
- In the procedure generally you can choose which content to use in the project – Zend Studio’s built-in PHP or Zend Framework.
To create a new local PHP project:
- In the menu-bar, go to File | New | Local PHP Project. The New Local PHP Project wizard displayed.
- Enter the following information:
- Project Name: Enter the name of your project.
- Location: Enter the location folder for your project.
PHP Server – Click the drop-down menu then select an existing server for deploying the new server project, or click Add Server to create a new server.
- Content: Select the content package you wish to work with in your project- Basic or Zend Studio’s built-in Zend Framework.
- If you chose to work with the built-in Zend Framework content package. If you wish to use a different version of Zend Framework, click on the drop-down menu, and then select Browse to use a different Zend Framework library.
- If you chose to work with the Basic package content, therefore click on the drop-down menu to select a PHP version.
3.Select the libraries you wish to add to the project, and then click Finish. Your project created, and displayed in the PHP Explorer.
2.Create PHP Files
Basically you can now start to develop your application by creating PHP files in your project.
To create a new PHP file within you project:
- In the PHP Explorer view, select the project you created.
- Right-click and select New | PHP File.
The PHP File creation dialog displayed.
- Enter the name of the file, and then click Next.
The Select PHP Template dialog displayed.
- Select a template as the initial content of the new PHP file, and click Finish.
therefore your file will open in the editor and will appear within your project in PHP Explorer view.
3.Create PHP Elements
You can use Zend Studio’s PHP element creation wizards to quickly and easily create PHP elements such as classes and interfaces within your code.
To create a new PHP class/interface:
- In PHP Explorer view, right-click the project/file in which you want to create the new class/interface and select New | Class or Interface.
- The New PHP Class/Interface/Trait wizard is displayed.
- Enter the required details and then click Finish.
The new class/interface will be created with the required code.
4.Code with Content Assist
1.Manually type code in your files. As you type, content assist will suggest code options according to the context of the code.
2.You can select a required code string to quickly insert it into your script. therefore if the Content Assist window does not pop up automatically, press Ctrl+Space.
5.Rename Elements (Refactoring)
1.If at any point during your development you want to rename an element, this can be easily done using the in-place refactoring feature.
2.This will apply the rename operation to all occurrences of the required element so that all links between elements are maintained.
To rename an element within the editor:
- In the editor, place your cursor on the element to be renamed.
- From the menu -bar select Refactor | Rename.
Right-click, and select Refactor | Rename.
All occurrences of the element put in a frame and then Refactor popup is displayed.
- Type the new element name in the box.
All occurrences of the element name automatically updated.
To preview the changes before applying them, click the arrow in the right-hand corner of the Refactor popup and select Preview.
- Click Enter to apply the refactoring.
The element will be renamed and then all instances where that element is referenced will be updated to reflect the changes.
6.Comment your Code
Generally it is good programming practice to comment all functions, classes and methods in your code. This helps both the developer and others who might look at the code to understand its purpose. Simply add a double slash “//” and comment away! Zend Studio also allows you to easily select and comment existing lines.
To comment lines:
- Select all the lines that you would like to be commented.
- Press Ctrl + /
Two slashes “//” will be added to the front of the line, recognizing it as a comment.
Zend Studio can automatically format your code accordingly to set standards to make it easily navigable and readable.
To format your code:
- Open the required file.
- Go to Source | Format Document or press Ctrl+Shift+F. At last your code automatically formatted.
8.Finding and Replacing
Zend Studio gives you a powerful search also replace mechanism for easily finding and replacing text strings in your code.
To find and replace a string:
- From within the file, press Crtl+F.
In the menu-bar, go to Edit | Find/Replace.
- A “Find/Replace” dialog will appear.
- Enter the required string to find.
- Enter the required string to replace it.
- If necessary, configure the settings under the direction, scope and options category.
- Click Replace.
The found string replaced by the new string.
9.Run your Application
Finally you’ve finished coding your application. Now what? You can preview the execution of your application by running it locally as CLI, nor as a Web application on your Web server.
Run as CLI Application
To run your application as a Web application:
- Place your application on a Web server.
therefore if you selected to create your project on a local Zend Server you can skip this step.
- In the PHP Explorer, right-click the file from which you would like to start the execution, and select Run As | PHP Web Application.The Run PHP Web Application dialog is displayed.
- Make sure the URL is correct, and then modify it if needed.
- Click OK. Finally your application run and displayed in Zend Studio’s internal browser.
You can periodically rerun your application to preview any changes you have made to your files during development. In general the files that will be executed the files situated locally on your workspace, irrespective of any changes made to the server copies of the files.
Finally once you’ve familiarized yourself with the basics, you can begin additional tasks in Zend Studio:
Locus Academy has more than a decade experience in delivering the training/staffing on Zend Studio for corporates across the globe. The participants for the training/staffing on Zend Studio are extremely satisfied and are able to implement the learnings in their on going projects.