Book Image

Expert PHP 5 Tools

By : Dirk Merkel
Book Image

Expert PHP 5 Tools

By: Dirk Merkel

Overview of this book

Even if you find writing PHP code easy, writing code that is efficient and easy to maintain and reuse is not so straightforward. Self-taught PHP developers and programmers transitioning from other languages often lack the knowledge to work with PHP on an enterprise level. They need to take their PHP development skills to that level by learning the skills and tools necessary to write maintainable and efficient code.This book will enable you to take your PHP development skills to an enterprise level by teaching you the skills and tools necessary to write maintainable and efficient code. You will learn how to perform activities such as unit testing, enforcing coding standards, automating deployment, and interactive debugging using tools created for PHP developers – all the information in one place. Your code will be more maintainable, efficient, and self-documented.From the design phase to actually deploying the application, you will learn concepts and apply them using the best-of-breed tools available in PHP.Experienced developers looking for expertise in PHP development will learn how to follow best practices within the world of PHP. The book contains many well-documented code samples and recipes that can be used as a starting point for producing quality code.Specifically, you will learn to design an application with UML, code it in Eclipse with PDT, document it with phpDocumentor, debug it interactively with Xdebug, test it by writing PHPUnit tests, manage source code in Subversion, speed up development and increase stability by using Zend Framework, pull everything together using continuous integration, and deploy the application automatically with Phing – all in one book. The author's experience in PHP development enables him to share insights on using enterprise tools, in a clear and friendly way.
Table of Contents (15 chapters)
Expert PHP 5 Tools
Credits
About the Author
About the Reviewers
Preface

Preface

This book will enable you to take your PHP development skills to an enterprise level by teaching the skills and tools necessary to write maintainable and efficient code. You will learn how to perform activities such as unit testing, enforcing coding standards, automating deployment, and interactive debugging using tools created for PHP developers—all the information in one place. Your code will be more maintainable, efficient, and self-documenting.

What this book covers

Chapter 1, Coding Style and Standards, explains how to define a coding standard that suits your development process and how to enforce it using PHP_CodeSniffer.

Chapter 2, Documentation with phpDocumentor, explains how to properly document your code with phpDocumentor and generate well formatted developer documentation.

Chapter 3, The Eclipse Integrated Development Environment, explains how to install, customize, and use the free PDT plug-in for Eclipse to create a powerful IDE for PHP development

Chapter 4, Source Code and Version Control, explores the ins and outs of subversion for distributed version control for development teams. It also teaches you to extend subversion functionality with PHP scripts.

Chapter 5, Debugging, teaches you to write your own flexible debugging library and master remote interactive debugging with Xdebug.

Chapter 6, PHP Frameworks, explains how to evaluate, compare, and choose frameworks that suit your projects and development style. Master the most commonly used modules of Zend Framework.

Chapter 7, Testing, explains testing methods and types, unit testing, creating comprehensive test suites with PHPUnit, and test-driven development.

Chapter 8, Application Deployment, states guidelines for automated and reversible application deployment, automating upgrades and deployments with Phing

Chapter 9, PHP Application Design with UML, introduces the reader to UML, class diagrams, sequence diagrams, and use cases.

Chapter 10, Continuous Integration, explains how to use CI, keep costs down and save time by discovering bugs and conflicts in your projects, at an early stage.

What you need for this book

To follow along with the examples, you will need a working version of PHP 5 installed on your system. Some of the chapters rely on command line tools such as pear and pecl, which are included in the standard distribution of PHP. Version 5.2.x of PHP or higher is recommended for maximum compatibility with the sample code. If you do not already have PHP installed on your system, you can download it from php.net here:

http://www.php.net/downloads.php

Although this book was written and coded on OS X, any flavor of MS Windows or Linux will do the job as well. Basic familiarity with your system's command line and a handy text editor for tweaking the examples will also be helpful.

Who this book is for

This book has been written for professional developers new to PHP and experienced PHP developers, who want to take their skills to the next level by learning enterprise level tools and techniques.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can include other contexts through the use of the include directive."

A block of code will be set as follows:

<fileset dir="${project.home}/build" >
<include name="*.properties" />
<exclude name="deprecated.properties" />
</fileset>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be shown in bold:

<fileset dir="${project.home}/build" >
<include name="*.properties" />

<exclude name="deprecated.properties" />
</fileset>

Any command-line input or output is written as follows:

$ phing upgrade-db

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to, and mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code for the book

Visit http://www.packtpub.com/files/code/8389_Code.zip to directly download the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration, and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.