PHP Objects, Patterns, and Practice, Second Edition

Book description

Backed by a tireless development community, PHP has been a model of language evolution over its 10+ year history. Borne from a contract developer's pet project, these days you'll find PHP powering many of the world's largest web sites, including Yahoo!, Digg, EA Games, and Lycos.

PHP Objects, Patterns, and Practice, Second Edition shows you how to meld the power of PHP with the sound enterprise development techniques embraced by professional programmers. Going well beyond the basics of object-oriented development, you'll learn about advanced topics such as working with static methods and properties, abstract classes, interfaces, design patterns, exception handling, and more. You'll also be exposed to key tools such as PEAR, CVS, Phing, and phpDocumentor.

Table of contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Introduction to the First Edition
  9. Introduction to the Second Edition
  10. PART 1: Introduction
    1. CHAPTER 1: PHP: Design and Management
      1. The Problem
      2. PHP and Other Languages
      3. About This Book
      4. Summary
  11. PART 2: Objects
    1. CHAPTER 2: PHP and Objects
      1. The Accidental Success of PHP Objects
      2. Into the Future: PHP 6
      3. Advocacy and Agnosticism: The Object Debate
      4. Summary
    2. CHAPTER 3: Object Basics
      1. Classes and Objects
      2. Setting Properties in a Class
      3. Working with Methods
      4. Arguments and Types
      5. Inheritance
      6. Summary
    3. CHAPTER 4: Advanced Features
      1. Static Methods and Properties
      2. Constant Properties
      3. Abstract Classes
      4. Interfaces
      5. Handling Errors
      6. Final Classes and Methods
      7. Working with Interceptors
      8. Defining Destructor Methods
      9. Copying Objects with __clone()
      10. Defining String Values for Your Objects
      11. Summary
    4. CHAPTER 5: Object Tools
      1. PHP and Packages
      2. The Class and Object Functions
      3. The Reflection API
      4. Summary
    5. CHAPTER 6: Objects and Design
      1. Defining Code Design
      2. Object-Oriented and Procedural Programming
      3. Choosing Your Classes
      4. Polymorphism
      5. Encapsulation
      6. Forget How to Do It
      7. Four Signposts
      8. The UML
      9. Summary
  12. PART 3: Patterns
    1. CHAPTER 7: What Are Design Patterns? Why Use Them?
      1. What Are Design Patterns?
      2. A Design Pattern Overview
      3. The Gang of Four Format
      4. Why Use Design Patterns?
      5. PHP and Design Patterns
      6. Summary
    2. CHAPTER 8: Some Pattern Principles
      1. The Pattern Revelation
      2. Composition and Inheritance
      3. Decoupling
      4. Code to an Interface, Not to an Implementation
      5. The Concept That Varies
      6. Patternitis
      7. The Patterns
      8. Summary
    3. CHAPTER 9: Generating Objects
      1. Problems and Solutions in Generating Objects
      2. The Singleton Pattern
      3. Factory Method Pattern
      4. Abstract Factory Pattern
      5. But That's Cheating!
      6. Summary
    4. CHAPTER 10: Patterns for Flexible Object Programming
      1. Structuring Classes to Allow Flexible Objects
      2. The Composite Pattern
      3. The Decorator Pattern
      4. The Facade Pattern
      5. Summary
    5. CHAPTER 11: Performing and Representing Tasks
      1. The Interpreter Pattern
      2. The Strategy Pattern
      3. The Observer Pattern
      4. The Visitor Pattern
      5. The Command Pattern
      6. Summary
    6. CHAPTER 12: Enterprise Patterns
      1. Architecture Overview
      2. Cheating Before We Start
      3. The Presentation Layer
      4. The Business Logic Layer
      5. Summary
    7. CHAPTER 13: Database Patterns
      1. The Data Layer
      2. Data Mapper
      3. Identity Map
      4. Unit of Work
      5. Domain Object Factory
      6. The Identity Object
      7. The Selection Factory and Update Factory Patterns
      8. What's Left of Data Mapper Now?
      9. Summary
  13. PART 4: Practice
    1. CHAPTER 14: Good (and Bad) Practice
      1. Beyond Code
      2. Borrowing a Wheel
      3. Playing Nice
      4. Giving Your Code Wings
      5. Documentation
      6. Testing
      7. Summary
    2. CHAPTER 15: An Introduction to PEAR
      1. What Is PEAR?
      2. Installing a Package with PEAR
      3. Using a PEAR Package
      4. Creating Your Own PEAR Package
      5. Summary
    3. CHAPTER 16: Generating Documentation with phpDocumentor
      1. Why Document?
      2. Installation
      3. Generating Documentation
      4. DocBlock Comments
      5. Documenting Classes
      6. File-Level Documentation
      7. Documenting Properties
      8. Documenting Methods
      9. Creating Links in Documentation
      10. Summary
    4. CHAPTER 17: Version Control with CVS
      1. Why Use Version Control?
      2. Getting CVS
      3. Configuring a CVS Repository
      4. Beginning a Project
      5. Updating and Committing
      6. Adding and Removing Files and Directories
      7. Tagging and Exporting a Release
      8. Branching a Project
      9. Summary
    5. CHAPTER 18: Testing with PHPUnit
      1. Functional Tests and Unit Tests
      2. Testing by Hand
      3. Introducing PHPUnit
      4. A Note of Caution
      5. Summary
    6. CHAPTER 19: Automated Build with Phing
      1. What Is Phing?
      2. Getting and Installing Phing
      3. Composing the Build Document
      4. Summary
  14. PART 5: Conclusion
    1. CHAPTER 20: Objects, Patterns, Practice
      1. Objects
      2. Patterns
      3. Practice
      4. Summary
  15. PART 6: Appendixes
    1. APPENDIX A: Bibliography
      1. Books
      2. Articles
      3. Sites
    2. APPENDIX B: A Simple Parser
      1. The Scanner
      2. The Parser
  16. Index

Product information

  • Title: PHP Objects, Patterns, and Practice, Second Edition
  • Author(s): Matt Zandstra
  • Release date: December 2007
  • Publisher(s): Apress
  • ISBN: 9781590599099