Object-Oriented PHP

Concepts, Techniques, and Code
by Peter Lavin

June 2006, 216 pp.
ISBN: 978-1-59327-077-3

This book is currently out of stock, but the ebook is still available

View a sample chapter, Chapter 8: Using the PageNavigator Class

It can be tough to learn the concepts of object-oriented programming with a language like C++. Fortunately, PHP's simple object model makes it an ideal language for learning about object-oriented programming.

For the uninitiated, this guide to the latest version of PHP offers a speedy introduction to object-oriented programming, including a thorough explanation of classes as well as coverage of constructors, destructors, inheritance, polymorphism, and interfaces. In this easy-to-follow, example-filled guide, new concepts are coupled with fully-functional, ready-to-use PHP classes (all available for download from the book’s companion website, http://objectorientedphp.com).

You’ll learn to:

  • Promote code reuse by creating your own classes and using built-in classes
  • Customize and improve classes through inheritance
  • Simplify database access by developing MySQL database and result set classes
  • Incorporate an RSS reader into your site using only four lines of code
  • Use XML easily with an object-oriented approach
  • Employ PHP to autogenerate documentation for your code
  • Make thumbnail images on the fly
  • Replace clumsy error trapping with exception handling
  • Take full advantage of advanced OO features in PHP
  • Incorporate AJAX into your OO PHP code

Object-Oriented PHP will show you how to maximize PHP’s features, with much less work than you might think. With Object-Oriented PHP, you can master the basics of object-oriented programming and get up to speed on PHP in one fell swoop.

Visit the book's companion site for accompanying downloads and additional resources. For updates and corrections, visit the errata page.


About the Author

Peter Lavin writes regularly on all things tech, from book reviews to web design, and runs a web development firm based in Toronto. He has been published in a number of magazines and online sites, including UnixReview.com and Doctor Dobb’s Journal, and is a contributor to PHP Hacks (O’Reilly).


Table of Contents

Chapter 1: What a Tangled Web We Weave
Chapter 2: Basics of Object-Oriented Programming
Chapter 3: Object-Oriented Features New to PHP 5
Chapter 4: Show a Little Class
Chapter 5: Mod UR Class
Chapter 6: The ThumbnailImage Class
Chapter 7: Building the PageNavigator Class
Chapter 8: Using the PageNavigator Class
Chapter 9: Database Classes
Chapter 10: Improvement Through Inheritance
Chapter 11: Advanced Object-Oriented Programming Concepts
Chapter 12: Keeping It Fresh
Chapter 13: More Magic Methods
Chapter 14: Creating Documentation Using the Reflection Classes
Chapter 15: Extending SQLite
Chapter 16: Using PDO
Appendix A: Setting Up PHP 5
Appendix B: Conversion Table: PHP 4 and PHP 5

(top)

Reviews

"A notable achievement of the book is to present PHP5 as a fully object-oriented language, a perspective that simply was not feasible before."
Sys Admin, November 2006 (Read more)

"The book illustrates good style in OO PHP5. The code provided is nicely written and makes intelligent use of PHP5's built-in library. The text is vernacular and confident . . . Lavin is at his best in explaining the ways different features meet needs that arise in real-world programming."
UNIX Review, November 2006 (Read more)

"Well-written and immediately engages the reader with practical and clearly explained examples . . . If you are part of the target audience for this book, I think you will find it of great value, and I can fully recommend it."
Groklaw, October 21, 2006 (Read more)

"By the time you've finished this book you'll have an excellent grasp of object-oriented programming . . . more importantly, you'll be able to create your own classes and extend existing ones."
Rootly, October 21, 2006 (Read more)

"There's an interesting challenge in writing a good book about programming. At a certain point, you'll lose the newbies and alienate the technical. We had an opportunity review No Starch Press's Object-Oriented PHP, and found it fits nicely into the gap."
OSNews.com, October 6, 2006 (Read more)

"Introduces OOP, explains why it's useful, and goes through to develop several sample applications to demonstrate OOPs power, and more importantly how to use it . . . I would recommend this book to beginner PHP developers, or intermediate developers who have not yet gotten their feet wet with OO."
PHP Architect, Sept. 12, 2006 (Read more)

"A practical approach."
SciTech Book News, September 2006 (Read more)

"Lavin's book is great, because it walks you through and explains how OOP in PHP should work . . . in an approachable and understandable manner."
Blogcritics, August 31, 2006 (Read more)

"An interesting and challenging book . . . Lavin has focused on a highly useful area of knowledge for web developers and has done an excellent job. Recommended."
Kickstart News, August 2006 (Read more)

"A top pick."
Midwest Book Review, August 2006 (Read more)

"A good book for any traditional/procedural PHP programmer who would like to know what those object-oriented PHP programmers are so excited about."
Bella Online, July 21, 2006 (Read more)

Book excerpt posted
Linux Journal, July 15, 2006 (Read more)

Tech tip adapted from book included in newsletter with 25,000 subscribers
Linux Journal Weekly, July 12, 2006 (Read more)

"The author takes a very practical approach that couples new concepts with easily reusable code."
PHP Architect, June 27, 2006 (Read more)

From blog of well-known AJAX expert: "I've had a couple of really good books from No Starch and this is no exception to that trend."
Brent Ashley blog, June 21, 2006 (Read more)

"Lavin's approach makes this book very easy to read . . . a useful book to add to your library."
Linux Security, June 16, 2006 (Read more)

(top)

Updates

(show updates)(top)