Expert PHP 5 Tools

Expert PHP 5 Tools
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Best practices for designing, coding, testing, and deploying PHP applications – all the information in one book
  • Learn to write unit tests and practice test-driven development from an expert
  • Set up a professional development environment with integrated debugging capabilities
  • Develop your own coding standard and enforce it automatically
  • Document your code for easy maintainability for yourself and others

Book Details

Language : English
Paperback : 468 pages [ 235mm x 191mm ]
Release Date : March 2010
ISBN : 1847198384
ISBN 13 : 9781847198389
Author(s) : Dirk Merkel
Topics and Technologies : All Books, Web Development, Open Source, PHP

Table of Contents

Chapter 1: Coding Style and Standards
Chapter 2: Documentation with phpDocumentor
Chapter 3: The Eclipse Integrated Development Environment
Chapter 4: Source Code and Version Control
Chapter 5: Debugging
Chapter 6: PHP Frameworks
Chapter 7: Testing
Chapter 8: Deploying Applications
Chapter 9: PHP Application Design with UML
Chapter 10: Continuous Integration
  • Chapter 1: Coding Style and Standards
    • Coding standard considerations
      • Pros
      • Cons
    • A PHP coding standard
      • Formatting
        • PHP tags
        • Indenting
        • Line length
        • Line endings
        • Spacing
        • Statements
        • Strings
        • Arrays
        • Control structures
        • Class and method definitions
      • Naming conventions
        • Class names
        • Property and variable names
        • Constant names
        • Method and function names
      • Methodology
        • Type hinting
        • Separating object creation from initialization
        • Class files
        • Class names and directory structures
        • Visibility and access
        • Including source files
        • Comments
        • Inline documentation
    • Coding standard adherence and verification
      • PHP_CodeSniffer for automated checking
        • Installing PHP_CodeSniffer
        • Basic usage
        • Slightly advanced usage
        • Validating against your own coding standard
    • Summary
  • Chapter 2: Documentation with phpDocumentor
    • Code-level documentation
      • Levels of detail
    • Introducing phpDocumentor
      • Installing phpDocumentor
      • DocBlocks
        • Short and long descriptions
        • Tags
      • DocBlock templates
      • Tutorials
        • Naming conventions and how to reference tutorials
        • DocBook syntax
      • Documenting a project
        • Documentation without DocBlocks
        • Documentation with DocBlocks
      • phpDocumentor options
        • Command line reference
        • Config files
        • Browser-based interface
      • Tag reference
        • Standard tags
        • Inline tags
      • PHP4 elements
      • Custom tags
    • Summary
  • Chapter 3: The Eclipse Integrated Development Environment
    • Why Eclipse?
    • Introducing PDT
    • Installing Eclipse
      • Requirements
      • Choosing a package
      • Adding the PDT plugin
    • Basic Eclipse concepts
      • Workspace
      • Views
      • Perspectives
    • A PDT sample project
    • PDT features
      • Editor
        • Syntax highlighting
        • Code assist
        • Code folding
        • Mark occurrences
        • Override indicators
        • Type, method, and resource navigation
      • Inspection
        • Projects and files
        • PHP explorer
        • Type hierarchy
      • Debugging
      • PDT preferences
        • Appearance
        • Code style
        • Debug
        • Editor
        • New project layout
        • PHP executables
        • PHP interpreter
        • PHP manual
        • PHP servers
        • Templates
      • Other features
        • PHP function reference
      • Eclipse plugins
    • Zend Studio for Eclipse
      • Support
      • Refactoring
      • Code generation
      • PHPUnit testing
      • PhpDocumentor support
      • Zend Framework integration
      • Zend server integration
    • Summary
  • Chapter 4: Source Code and Version Control
    • Common use cases
    • A brief history of source code control
    • CVS
    • Introducing Subversion
      • Client installation
      • Server configuration
        • Apache with mod_dav_svn
      • Subversion concepts
        • Repository
        • Tags
        • Trunk
        • Branches
        • Working (Local) copy
        • Merging
        • Revisions and versions
        • Updating
        • Comparing
        • History/Log
        • Annotating code
        • Reverting
        • Committing
      • Subversion command reference
        • svn
        • svnadmin
        • svnlook
        • svnserve
        • svndumpfilter
        • svnversion
      • Creating a Subversion project
      • Basic version control workflow
      • A closer look at the repository
        • Data store
        • Layout
      • Branching and merging
        • What is a branch?
        • Why branch?
        • How to branch?
        • Maintaining and merging a branch
        • Branching workflow
      • UI clients
        • Eclipse plug-ins
        • TortoiseSVN
        • WebSVN
    • Subversion conventions and best practices
      • Customizing Subversion
        • Hooks
        • Notifying developers of commits with a post-commit hook
    • Summary
  • Chapter 5: Debugging
    • First line of defense: syntax check
    • Logging
      • Configuration options
      • Customizing and controlling config options: PhpIni
        • PhpIni example
    • Outputting debug information
      • Functions
        • echo(string $arg1 [, string $... ] / print(string $arg)
        • var_dump(mixed $expression [, mixed $expression [, $... ]]) and print_r(mixed $expression [, bool $return= false ])
        • highlight_string(string str [, bool return]) and highlight_file(string filename [, bool return])
        • get_class([object object])
        • get_object_vars(object object)
        • get_class_methods(mixed class_name)
        • get_class_vars(string class_name)
        • debug_backtrace()
        • debug_print_backtrace()
        • exit([string status]) or exit (int status)
      • Magic constants
      • Writing our own debugging class
        • Functional requirements
        • DebugException
    • Introducing Xdebug
      • Installing Xdebug
      • Configuring Xdebug
      • Immediate benefits
        • var_dump() improved
        • var_dump() settings
        • Errors and exceptions beautified
        • Protection from infinite recursion
      • Remote debugging
        • Remote server debug configuration
        • Debugging client configuration
    • Summary
  • Chapter 6: PHP Frameworks
    • Writing your own framework
    • Evaluating and choosing frameworks
      • Community and acceptance
      • Feature road map
      • Documentation
      • Code quality
      • Coding standards and compliance
      • Project fit
      • Easy to learn and adapt
      • Open source
      • Familiarity
      • Their rules
    • Popular PHP frameworks
      • Zend
      • CakePHP
      • CodeIgniter
      • Symfony
      • Yii
    • Zend Framework application
      • Feature list
      • Application skeleton
        • Important concepts
        • Application structure detail
      • Enhancements
        • Adding a layout
        • Adding views
        • Adding logging
        • Adding a database
        • Adding a model
        • Adding a controller
        • Putting it all together
    • Summary
  • Chapter 7: Testing
    • Testing methods
      • Black box
      • White box
      • Gray box
    • Types of testing
      • Unit testing
      • Integration testing
      • Regression testing
      • System testing
      • User acceptance testing
    • Introducing PHPUnit
      • Installing PHPUnit
      • String search project
        • BMH algorithm basics
        • Implementing BMH
        • Unit testing BoyerMooreStringSearch
        • The test class
        • Assertions
        • Organization
        • Our first unit test
        • Extended test class features
        • Automation: generating tests from classes
        • Automation: generating classes from tests
        • Test-driven development
      • Code coverage
      • TestCase subclasses
    • Summary
  • Chapter 8: Deploying Applications
    • Goals and requirements
    • Deploying your application
      • Checking out and uploading files
      • Displaying an under-maintenance message
      • Upgrading and installing files
      • Upgrading database schema and data
      • Rotating log files and updating symbolic links
      • Verifying the deployed application
    • Automating deployment
      • Phing
        • Installing Phing
      • Basic syntax and file structure
        • Tasks
        • Targets
        • Properties and property files
      • Types
        • Filters
        • Mappers
        • The project tag
      • Deploying a site
        • Separating external dependencies
        • Creating a build script
        • Directory skeleton
        • Subversion export and checkout
        • Building files from templates
        • Maintenance page
        • Database backup
        • Database migrations
        • Going live
        • Putting it all together
        • Backing out
    • Summary
  • Chapter 9: PHP Application Design with UML
    • Meta-model versus notation versus our approach
    • Levels of detail and purpose
    • Round-trip and one-way tools
    • Basic types of UML diagrams
    • Diagrams
      • Class diagrams
        • Elements of a class
        • Static methods and properties
        • A class diagram example
        • Relationships
        • Interfaces
        • Example refactored
        • Code generators
      • Sequence diagrams
        • Scope
        • A sequence diagram of the network scanner
      • Use cases
        • Use cases—diagrams optional
        • When to create use cases
        • Example use case
    • Summary
  • Chapter 10: Continuous Integration
    • The satellite systems
      • Version control: Subversion
        • Commit frequency
      • Testing: PhpUnit
      • Automation: Phing
      • Coding style: PHP_CodeSniffer
      • Documentation: PhpDocumentor
      • Code coverage: Xdebug
    • Environment setup considerations
      • Do I need a dedicated CI server?
      • Do I need a CI tool?
    • CI tools
      • XINC (Xinc Is Not CruiseControl)
      • phpUnderControl
    • Continuous integration with phpUnderControl
      • Installation
        • Installing CruiseControl
        • Installing phpUnderControl
        • Overlaying CruiseControl with phpUnderControl
      • CruiseControl configuration
      • Overview of the CI process and components
        • CruiseControl and project layout
        • Getting the project source
        • Configuring the project: build.xml
        • Configuring CruiseControl
        • Advanced options
        • Running CruiseControl
        • Replacing Ant with Phing
    • Summary

Dirk Merkel

Dirk Merkel is the owner of Waferthin Web Works LLC. In his spare time, he likes to ruin perfectly good open-source projects by submitting unsolicited patches. He also writes about Web development. He lives in San Diego with his lovely wife and two wonderful daughters. Dirk can be reached at

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 2 submitted: last submission 23 Dec 2011

Errata type: Code | Page number: 13 |

if (is_array($myHash)) { throw new Exception("myHash must be an array!"); } ... should be if (!is_array($myHash)) { throw new Exception('$myHash must be an array!'); }


Errata type: Code | Page number: 23 |

if (is_array($myHash)) { // inline comment indented with code throw new Exception("myHash must be an array!"); should be if (!is_array($myHash)) { // inline comment indented with code throw new Exception('$myHash must be an array!');


Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Expert PHP 5 Tools +    Microsoft SQL Server 2012 Performance Tuning Cookbook =
50% Off
the second eBook
Price for both: $45.60

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Set up a development environment that provides code completion, syntax highlighting, interactive debugging, code templates, and more
  • Define a coding standard and automate compliance checks
  • Generate developer documentation in various formats using code-level comments and phpDocumentor
  • Manage revision and branching, tag, and merge code using a distributed version control system
  • Create your own debugging library and use Xdebug for interactive debugging
  • Shorten the development cycle by leveraging a suitable framework for your application
  • Write unit tests using PHPUnit and practice test-driven development
  • Automate application deployment and configuration using Phing—a PHP build and automation tool
  • Sketch class diagrams, sequence diagrams, and use cases using UML
  • Quickly find bugs and conflicts by setting up a continuous integration environment that automatically stages, tests, and documents your project

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

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

Chapter 3. The Eclipse Integrated Development Environment
Learn 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
Explore the ins and outs of subversion for distributed version control for development teams. Extend subversion functionality with PHP scripts

Chapter 5. Debugging
Write your own flexible debugging library or master remote interactive debugging with Xdebug.

Chapter 6. PHP Frameworks
Evaluate, compare, and choose frameworks that suit your projects and development style. Master the most commonly used modules of the Zend framework

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

Chapter 8. Deploying Applications
Guidelines for automated and reversible application deployment, automating upgrades, and deployments with Phing

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

Chapter 10. Continuous Integration
Use CI, keep costs down and save time by discovering bugs and conflicts in your projects, in the early stages

In Detail

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.

An in-depth look at best-of-breed enterprise-level tools, methodologies, and tips for professional PHP developers to write maintainable, efficient code


Each chapter focuses on one topic, such as version control or debugging. After initially discussing essential concepts, the author takes an in-depth look at one or more tools relevant to the topic. Sample projects and plenty of well-documented code are used to work through practical application of the concepts.

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.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software