Author: Davey Shafik, Lorna Mitchell & Matthew Turland
Aimed at: Experienced programmers
Pros: Refreshingly high-level presentation of ideas
Cons: Not project-oriented
Reviewed by: Alex Armstrong
Subtitled "Write Cutting-Edge Code", does this book deliver on its promise?
What is being a PHP master all about? From the cover of this new book it look as if you are about to cook a chef's quality meal - perhaps that's not a bad analogy?
If you are looking for a book to get you started with PHP then look elsewhere because this is a book for programmers who either know PHP or aren't intimidated by learning a new language on the fly. It also isn't a book that shows you how to build a complete project. This book is about ideas and how to use PHP in a modern, object-oriented way.
Chapter 1 gets the show started with a look at the basic ideas of Object Oriented Programming (OOP) as applied to PHP. As PHP wasn't originally object-oriented, and many introductions don't mention objects till much later, this is a more adult approach to PHP than most. However it doesn't tell you the basics of the language so you are expected to know about for loops, if statements, functions and so on. At the end of the chapter you should know how to work with PHP in an object-oriented way. The only real problem is that you might be in for a shock if you start to look at some real world PHP programs because mostly these are not object oriented.
Chapter 2 moves on to a more pragmatic topic, in the form of how to work with a data base using the PDO library. Again this is an object oriented approach to database access and again it isn't the way most PHP scripts approach the problem. It is a good way to do the job but if you have to mainatin existing PHP then you might still have to look things up on how it is done not using PDO.
The next chapter takes a bit of a break from the object-oriented theme and attempts to educate you in how PHP can be used to create APIs - more usually called webservices. This takes you through building SOAP and REST based web services and then on to consider how to write the server side of a typical Ajax system.
Chapter 4 brings us back to theory with a look at patterns. All of the standard "Gang of Four" patterns are covered in a fairly standard way, but of course all expressed in PHP. Chapter 5 takes a very general look at security. It has to be general because security for any real system depends very much on the nature of the system.
Chapter 6 is on performance but more on how to profile a program than on hints and tips on how to make your code go faster. Chapter 7 is on automated testing and the final chapter is on quality assurance, The book concludes with appendixes on PEAR and PECL, PHP's code repositories and on SPL the standard PHP object oriented library.
This book shows you PHP at its best used with knowledge and understanding. However, real world PHP is often written as a single big "script" that makes use of none of these modern ideas. If you are going to have to work with an existing system you probably need to learn rather more PHP idioms than this book teaches. This is rather idealized view of PHP but it is one to strive for if you have the opportunity to write some fresh code.
If you already know an object-oriented language and want to get up to speed with PHP this is a good way to do it. If you are looking for a step-by-step or a cookbook then this is not for you. It is also possible that if you know a lot about object-oriented programming, patterns, testing and so on you might find that it is just a restatement of everything you know, but with a PHP accent. Of course, this exactly what the book sets out to do so, as long as you are at the right level of knowledge, this is a good book.