PhpRiot
Browse Articles
Ajax (4), APC (1), CAPTCHA (1), CSS (3), Debugging (1), File Upload (1), Google (3), Google Maps (2), JavaScript (12), JSON (2), MVC (1), MySQL (7), onbeforeunload (1), OOP (1), PHP (28), PhpDoc (1), PostgreSQL (6), Prototype (11), Reflection (1), RFC 1867 (1), Robots (1), Scriptaculous (1), SEO (1), Sessions (1), SimpleXML (1), Smarty (5), SOAP (1), SPL (1), Templates (2), W3C (1), XHTML (1), Zend Framework (1), Zend_Search_Lucene (1)

Buy My Book
Practical Web 2.0 Applications with PHP

Practical Web 2.0 Applications with PHP

Want to assert yourself as a cutting–edge PHP web developer? Take a practical approach...

PHP Objects, Patterns, and Practice, Second Edition

PHP Objects, Patterns, and Practice, Second Edition
  • Media: Book (Paperback, 487 pages)
  • ISBN: 1590599098
  • Publisher: Apress
  • Release Date: Dec 20, 2007

Buy from Amazon Buy from Amazon


Product 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.

What you’ll learn

  • Write solid, maintainable code by embracing object–oriented techniques and design patterns.
  • Create detailed, versatile documentation using the powerful phpDocumentor automated documentation system.
  • Gain new flexibility during the development process by managing your code within a CVS repository and using the Phing build system.
  • Capitalize upon the quality code of others by using the PEAR package management solution.

Who is this book for?

PHP developers seeking to embrace sound development techniques such as object–orientation, design patterns, testing, and documentation

Related Titles from Apress

  • Beginning PHP and MySQL: From Novice to Professional, Third Edition
  • Pro PHP: Patterns, Frameworks, Testing and More
  • Beginning Google Maps Applications with PHP and Ajax: From Novice to Professional

Rating: 5/5 Interesting and easy to read PHP OO primer

I have experience in a variety of object oriented (OO) languages, but not PHP. This book has helped me understand how PHP supports objects and some of the typical design patterns you will see in OO PHP.
Although it is written with PPH5, it even covers some aspects of OO in PHP4.
It is easy to read, interesting and contains good code examples.
This isn't a PHP Beginners book, although I'm not fully familiar with PHP and haven't had a hard time reading this book, probably because of my OO background and basic PHP knowledge. Still, if you just need a PHP beginners book, this isn't the one.
It is a great book if you want to learn OO PHP or even just some OO principles in general. Very glad I picked this book up.
Submitted 14 Jul 2008

Rating: 4/5 Very good book, despite some muddled spots

I've owned PHP Objects, Patterns, and Practice for over a year, and it's still one of those books I go back to. It's a well written, generally well executed book on what constitutes Object Oriented Programming in the PHP5 environment.

First, the good news:

This book is a crash course on OOP design and thought. It borrows heavily from two monumentous texts in the field - the Gang of Four's book, and Java Enterprise Patterns - and condences their essences into an easy to swallow form. The basics are all here: how to create well designed classes, how to instantiate objects, etc. There's a hidden gem in the introductory portion of the book: the Reflection API. This API is built into PHP, and gives the coder unparalleled access to the guts of the classes and objects in a given project. It definitely has its uses.

The patterns are all generally useful, with the only exception perhaps being the Interpreter pattern. I'm just not convinced that creating one's own command line interface syntax is necessary, given that PHP projects aren't usually interactive. It seems like something best left to an appendex, or extra web content.

Now, for the bad news:

Some sections of the book, especially some of the code examples, could've used a better editor. Small things, the kinds of things that can trip up inexperienced coders, crop up. Using private properties instead of protected. Using the wrong variable name between examples. That sort of thing.

There's also a lack of a satisfying conclusion, so-to-speak. Zandstra himself claims that generating objects is perhaps the hardest thing to demonstrate. Yet, most of his examples (excepting the patterns late in the book) are canned. Objects and classes exist only to drive the theory behind a pattern home. Few real world examples are given. Admittedly, some patterns are simple to transfer to a real project, but concrete examples of that nature could serve to further cement his point. For example, it's not difficult to see how the Composite pattern would work well for dealing with an XML document, but would there ever be a need for a Visitor object to act on one?

Finally, and in continuation of my last criticism, Zandstra never touches one of the things PHP is used the most for: form handling. Can forms be represented by classes? Could forms be generated by objects (perhaps using a Factory pattern)? What about form validators? Wouldn't the Strategy or Decorator pattern work? Supplementing his online Civilization game and CLI/quiz examples with this would've really put the book over the top.

Still, with that said, PHP Objects, Patterns, and Practice is still a text that gets far more right than wrong. It's definitely a must-buy for those PHP coders looking to write modular code.
Submitted 20 Mar 2008

Rating: 5/5 Best OO book on PHP ever

This is the best book I've read on Object Orientated PHP. This book does a great job of explaining the ins and outs of OO in PHP 5. As a self taught PHP developer of 5 years, I had lots of questions about "am I doing this right", "how should this be done" and the book has answered most of those questions.

I'd recommend the book to those who already have an advanced PHP knowledge but are looking to take their code another step forward by improving it's re-usability. It's also a great read if you want to find out the power that PHP 5 has over PHP 4.

Note: this book doesn't contain code that you can use. It teaches you the principles that you should use in your own projects.
Submitted 18 Mar 2008

Rating: 3/5 Great book but...

This is a really great book for advanced developers who whant learn abount php5 OOP technique; it explain very well how objects work and how to use the most famous patterns but it fails in third section: "The Practice".

CVS, PHPDoc and Phing, for me, are not enought for a good "Practice".

The entire book use too much simplistic examples, and so, is very difficult, for a beginner, to use all book concepts in real world.

I hope that in the next edition, Matt will fill this gap.

Bye From Italy

Submitted 27 Feb 2008

Rating: 5/5 Great Book!

I've personally read about 100+ IT-related books, ranging from Certification Crams, Networking, Programming, and even computer repair. I've developed with PHP for almost 7 years now, having over 10 years of development language experience overall with other languages. What I'm about to say may surprise some, some may even find it hard to believe, and even more will absolutely disregard it as truth. On the flip side, what I am about to say may intrigue you, have you yearning to learn more, or even have you ready to go buy the book at this very moment. Either way that's your opinion, your thoughts and ultimately your decision. I'm simply telling it how it is, while being as truthful as I possibly can be.
PHP Objects, Patterns, and Practice is by far, the most thought out, well planned and pleasant books I've read on any subject, period. Most technical books leave you feeling like the author was some sort of robot from Mars, sent to Earth intent upon teaching humans how to write code. This book takes a totally different approach, an approach that I could only dream of taking to explain advanced concepts that Mr. Zandstra explains.
The book begins with giving the reader a "blast to the past" look at how PHP started out, how it evolved and what we should be expecting to see in the future. It explains how OOP came into being, how it became much more than the author's could ever dream, and how it eventually became the selling point for PHP. After giving you a brief history lesson, it finally starts into the actual technical sections. Once again, they follow the idea of showing the reader where PHP went wrong, and then finally how they made up for it by doing it the way it was supposed to have been done.
The first three chapters explain the above in extreme and perfect detail. The following chapters begin your development cycle by first bringing the reader up to speed on OOP basics followed by advanced topics that help mold your mind around working in PHP's brand new OOP environment. The chapters after basically keep building on top of that foundation, zeroing in on trouble areas followed by intelligent solutions to each problem. Every single page I read, I learned something new. Every single exercise, I said to myself, wow...I can't believe I've made it this far without knowing this.
What makes this book so appealing to me is that it's not meant for the newbie as almost every book you find at Barnes and Nobel will be. Instead, it's directed at the seasonal developer, the developer who has already been coding in PHP for 4+ years, developed long enough to know what PHP can and cannot do. It's also for the developer who has longed for a book that gives us incentive for moving to 5 and away from our trusty stable PHP 4 release.
Matt uses such an impressive means of explaining how things work, that I probably have learned more in this 470 page book (yes, I even read the Appendixes, which is an honest-to-God first for me) than I've learned in any 1000+ page book. Every time I met a new chapter, I found myself ready to open the trusty laptop and try it out instead of skipping about 10 chapters to finally get to a place that actually covered something meaningful.
Matt Zandstra, my hat is off to you. This book was everything I have been looking for in a PHP book.

-Jonathon Hibbard 02/15/08
Application Developer, HSR Business to Business
Submitted 23 Feb 2008

You May Also Like ...





PHP in Action: Objects, Design, Agility

PHP 5 Recipes: A Problem-Solution Approach