Rapid Development
Total Page:16
File Type:pdf, Size:1020Kb
REVIEWS Zend Studio 4 Exploring the Zend Studio 4 developer environment RAPID DEVELOPMENT PHP experts consider Zend Studio the most mature and feature-rich IDE for PHP. The latest version offers enhanced database manip- ulation and other improvements. We’ll put the Zend Studio IDE through its paces and show you how you can use it to speed up PHP development. BY CARSTEN MÖHRKE he choice of an integrated devel- opment environment is often a Tmatter of taste. Many PHP devel- opers prefer text editors like Emacs or Vim. Developers who favor a more inte- grated approach have several choices in the Linux world. The free Quanta Plus IDE, the closed source Maguma environ- ment, and even Eclipse (with the right Zend Studio has set of plug-ins) are all genuine alterna- the reputation of being tives to an editor. For PHP developers, one of the most mature and pow- erful IDEs. version that disables so many useful Zend Studio Personal Edition Zend Studio is the brainchild of Isra- features it is not really worth the effort The following features are not available el’s Zend Software, a vendor that prefers (see the box titled “Zend Studio Personal in Zend Studio Personal Edition: to be known as “The PHP Company.” Edition”). Older versions often suffered from per- • Profiler Installation • Code Analyzer formance problems or instability, but the • CVS support latest version, Zend Studio 4, is an After downloading and unpacking the extremely powerful and stable developer 47MByte archive, you can launch the • Inspectors environment. Zend Studio is neither installation program directly. A wizard • FTP support Open Source, nor is it free of charge, prompts you for a few required details. • Remote Debugging although US$ 249 is a fair asking price. Besides the typical questions concerning • Function descriptions in code comple- You can download a trial version from directories, you can say which PHP ver- tion the Zend website. The test version is sion you want Zend to support (4 or 5). • File searching full-featured for the 21 day trial period PHP 4 and 5 are not one hundred per- • Printing and then degrades to the “Zend Studio cent compatible and have different com- • Block indenting Personal Edition,” a non-commercial mand sets, so this selection will influ- 42 ISSUE 57 AUGUST 2005 WWW.LINUX - MAGAZINE.COM Advertisment Figure 1: An installation wizard walks you through the Zend Studio installation process. Make sure you install the Zend Studio Server. ence syntax highlighting and shows files, servers, and checking. The good news is databases for direct access. that you can change your Below this are various inspec- mind later. Another impor- tors that give developers a tant part of the installation is quick overview of the files, deciding whether to install classes, and methods belong- Zend Studio Server (Figure ing to the current project. The 1.) Say yes, because you will lower part of the screen is need the server for effective reserved for messages and debugging later. the debugging window. The second window gives you Interface information on variable val- After completing the installa- ues, the call stack, and simi- tion, Zend Studio automati- lar things. On the right is a cally detects your system’s display area that gives you language settings and the “screen output.” This launches with the correct lan- area provides an at-a-glance guage support. At this time of overview of the output the writing, the environment script generates. Zend Studio supports English, French, also displays the HTTP head- German, Russian and Span- ers; this is a useful feature, ish. and one that a browser would The user interface (Figure not give you. Finally, the edit- 2) is divided into a number of ing window is at the center of panels. The top left area the screen. Good news for Figure 2: The Zend Studio user interface. REVIEWS Zend Studio 4 those of you worrying where to put all when you launch the IDE, and this can one of the most useful tools. While you those panels on a small screen: you can be really annoying if you have a long list are typing, Zend Studio shows a list of scale panels and hide any you do not of servers, or if connections are down. functions, variables, or other items that need. Zend Studio also has CVS support, start with the letters you have typed. which you can again configure through Considering the number of PHP com- Settings the tools menu. mands, the fact that the system gives a Before you start using Zend Studio for short overview of what each function production, you will probably need to Setting up a Database actually does is very useful. A parameter tweak a few settings. The dialog box for Server list appears when a function has been personalizing the system is titled Prefer- Direct access to database servers is a uniquely identified. ences and is launched by selecting Prefer- new feature in Zend Studio 4. Clicking Zend Studio dynamically adds any ences in the tools menu. on SQL in the file management window functions, variables, and classes you Many of these settings are a matter of (top left) displays a list of configured define to the code completion list. This personal preference. However, there are servers. Of course, the list will be empty is not restricted to the file you are cur- a few additional options that you will if you have just finished installing the rently editing, but also includes any need to change to give you a useful program. To populate the list, right click other files you have open at the same developer environment. For example, in the window and select “Add Server” time. (The code completion feature can you can define how to display the tabu- to open the window shown in Figure 4. lead to confusion when Zend offers you lator in the Editing tab. The Newline Currently, Zend Studio supports direct a class from an open file that is not part format can also be important; this set- access to the following database servers: of your current project.) ting specifies whether a newline is Oracle, SQLite, Microsoft SQL Server, As PHP does not support variable type represented by a carriage return and line PostgreSQL, and MySQL. After entering declarations, Zend Studio has no way of feed (Windows standard) or just by a your access credentials, you can immedi- knowing what data type a parameter you line feed (Unix standard). ately access the server. Right clicking pass to a function should represent. opens a connection and gives the devel- However, developers can add documen- Configuring the Server oper environment access to any data- tation blocks (docblocks) to provide this In many cases, you will need to work on bases, tables, and records for which the information for their own functions, files stored on a server. The Zend IDE current user has permissions. classes, and methods. To do so, right gives you the ability to store files directly Developers can view the table struc- click on a function in the Project Inspec- on the server using an FTP connection. ture or content in the window normally tor and select Add description to insert You can use SFTP or FTP over SSH for occupied by the editor. Zend Studio does an empty docblock. more security if necessary. The file menu not support direct record manipulation, The first line should be a short takes you to the dialog where you can however, as it does not claim to be a description of the function, which will set up a new server connection (Figure database front-end. In database mode, also appear in the code completion help. 3.) To set up a connection, you need to you can use the lower part of the inter- Docblocks are tag extensible, allowing supply the usual information, such as face to enter SQL commands (Figure 5). them to describe the properties of a the host and user names and a pass- This feature allows developers to verify function or class. Tags always start with word. Make sure you uncheck the Recon- SQL queries before adding them to the @. A tag needs to be preceded with an nect on Startup option or Zend Studio PHP codebase. asterisk (*) and a blank. For example, an will attempt to connect to the server entry such as @return: would describe Production the return type for the function. The Although Zend Studio does allow you to @param: tag refers to a parameter. You edit individual files, developers will need a separate entry for each parame- more typically want to work on projects. When you add a new project by select- ing New Project in the Project menu, a wizard pops up to prompt you for the project name, the path for storing the project files, and the debugging prefer- ences for the project. After you create a project, the new project is displayed on the left in the Project Inspector area. You can now right click or use the File menu to add files to the project. Zend Studio has several useful fea- tures to support encoding work. Besides Figure 3: The Configure FTP Server dialog syntax highlighting, which even the box lets you set up a connection to an FTP most simple of editors now support, server. automatic code completion is probably Figure 4: Configuring an SQL server. 44 ISSUE 57 AUGUST 2005 WWW.LINUX - MAGAZINE.COM Zend Studio 4 REVIEWS sequence [Ctrl]+[Alt]+[A] or by accessing the analyzer through the tools menu. Debugging Of course, Zend Studio helps developers locate more hidden errors.