Category Archives: Reviews

review: Expert PHP5 Tools

In short: great overview of the various tools and processes that can be followed to make working in PHP easy and manageable. I have a new employee here in the office who will be getting this book after me, to quickly bring her up to speed on good practices.

The Good

As you might guess from the “new employee” comment, even though the word “Expert” is in the title, you don’t need to be an expert PHP programmer to use this book. It’s an all-round overview of the programs you might use during your day-to-day programming life for the next few years.

As the author (Dirk Merkel) suggested in the book, some people may disagree with some choices in the book. For example, I am a fervent Vim user, but the book chooses Eclipse as its programming environment of choice.

From a broader point of view, the Eclipse IDE may be the correct one for programmers to use, as it offers much more than just a text editor. As for me, it’s hard to change an old dog’s habits!

The book includes some handy reference notes for various tools, such as SVN or phpDocumentor. It’s good for people that are not used to reading online references for everything to have them all in one book.

Each chapter is immensely in-depth. To the point that it’s almost like each chapter is a mini-book on its own subject. In some cases the chapters include everything you might ever use on those subjects.

For myself, I’m interested to try some of the suggestions in the Continuous Integration chapter and throughout the book, as I already run a few projects where updates are more important than releases. I’m especially interested in integrating SVN with automated testing and style-checking. Test-driven Development is described in the book, and it certainly seems more robust than my current “deadline-driven development” style!

The Bad

There were code samples in there that could have been shortened immensely by choosing a different spacing scheme or reducing the comments. For example, in the Debugging chapter, there is a code sample that goes on for 9 pages. That’s a lot of code to read… If the empty lines and comments had been removed or reduced, Dirk could have cut it down to maybe 4 or 3 pages, making it much more readable in print. As it was, I did my best to read through it, flipping back and forth between pages to find where references went or came from.

The Ugly

Actually, there wasn’t really anything in this book that I’d call ugly, apart from the overly long code examples.


Immensely useful for the professional programmer. Especially a programmer who needs to fit into a team.

I’m no beginner myself, and picked up quite a few tips throughout the book.

Buy this book – it’s worth it.

win a copy of jQuery 1.3 With PHP

I’ve just noticed that a site is running a competition to give away a copy of my book.

competition page

All you need to do is leave a comment explaining how you intend to use jQuery in your next project.

If you want to see reviews of the book, I’m maintaining a list of reviews here.


Because it’s difficult to know exactly how well my book is doing, I went looking for online apps that might be able to help.

I came across NovelRank a few weeks ago, which keeps track of your Amazon SalesRank and uses the fluctuations in the value to try figure out when a sale happens.

At first I was a bit disappointed, as my own ratings should not many sales going on, but I realised that this was because there were no reviews out there so people a) didn’t know about the book, and b) didn’t know if it was worth buying.

Since the reviews have started coming in, sales have picked up, as can be seen in the NovelRank graph for my book.

I like this application – it’s a simple idea, and the author has made it freely available (I assume he makes money from affiliate links).

Want to see it in action? Buy JQuery 1.3 with PHP and then view NovelRank graph for my book the graph a few hours later to see your very own blip appear on it.

It’s interesting to see that the book is not selling at all in Canada. What’s wrong with you Canadians?? ;-)

On a very related note, I’m in talks with Packt to produce another book. More on this later when details are more concrete.

jQuery 1.3 With PHP; buy it!

Christmas is coming, as most of us (especially parents and people that have wallets) know, so it’s time for ye all to dig deep and buy the perfect gift for that favourite web developer in your life.

Not knowing what that perfect gift could possibly be, I’ll recommend instead that you invest in a copy of my book, JQuery 1.3 with PHP.

Reviews are just starting to come in. I only know of two on-line ones so far, my favourite of which is this one:

The author does a great job of introducing complicated theories and breaking them down into manageable steps, whilst always taking very thorough considerations for applying jQuery knowledge into CMS ’s and web applications.

I noticed that the same reviewer posted this on Twitter: thoroughly impressed with reading jQuery 1.3 with PHP. writing a review on it, will be available soon!

The other one that I’m aware of is more of a list of notes than a review. The only thing he says in general about the book is “Overall a good book.”

There are a few minor criticisms in the second review that I don’t agree with – that I didn’t use inline functions in all cases, didn’t use Google’s functions to load jQuery from its CDN, and used document.getElementById in some cases instead of using jQuery’s $ function.

My reaction to those points are: inline functions are explained later in the book as I didn’t want to throw the reader head-first into understanding them, there’s no point in loading three libraries (google, jquery and jquery-ui) when you only need jquery and jquery-ui, and for the purposes of getting an element by its ID, document.getElementByID is much quicker than $.

I think the real problem with my decisions with the above points is that, after having had them pointed out as mistakes, I feel I should really have explained more clearly in the book why I chose to do things in those ways in the first place. Well, that’s something for edition 2 :-D

So far, though, the reactions are positive, and I hope this continues – there haven’t been any “this is crap” reviews so far, which is good.

I know of a few other people that are writing reviews, and can’t wait to see them. So reviewers, please do criticise it – it makes the end-product better.

And christmas shoppers, it’s a great book ;-)

Mastering phpMyAdmin 3.1

Last year, I reviewed Mastering phpMyAdmin 2.11 for Packt, and said it was overall a comprehensive book, but with a few points that I would change.

I was sent a copy of Mastering phpMyAdmin 3.1 a few weeks ago and after reading it, I can see that most of the points I mentioned have been addressed, and I know from other sources that the points that were not changed have good reasons for them (screenshots and we/our speech are very good for people that are not familiar with the subject).

There are many reviews of this book already, so I will mostly describe how this edition is different from the previous one. In short, though, I would say that this version is much more readable, and is still the best book to buy if you want a book on phpMyAdmin. The reviews I’ve read here all agree with my own assessment that phpMyAdmin is a surprise – right when you think you know what it does, a book points out a load of stuff you didn’t know it did.

Things that are improved

I suggested last year that the 5 page date-by-date history of phpMyAdmin’s delivery be moved from the front of the book to an appendix. At the time, the book didn’t have an appendix. The new edition has two appendices – the first one is for the history, as suggested, and the second contains the old book’s chapter 20 on Troubleshooting. The short history of MySQL at the beginning of the MySQL 5.0 chapter has also been removed – it had no purpose.

A few of the unnecessary screenshots have been removed. I understand the need for screenshots, as they sometimes describe better than mere text what the author means when he says something, but my complaint from last year was that screenshots that were simply not necessary had been put in apparently just to take up space. This has been improved this year, with many of the redundant images removed.

SQL code screenshots have been replaced with just the text of the SQL. This makes the examples much easier to read.

Language issues, such as switching collations, had originally been a full chapter, but is now spread out in the book, where appropriate. This is good, as when exporting a backup (for example), you don’t want to have an important part of the explanation, collation, hidden away at the back of the book.

A lot of the “since 2.6.1″, “since 2.6.0″ wording has been removed. This is good, as the reader of the book is obviously using version 3.1 or higher. The author does sometimes mention the version number when adding new text, and I think that’s unnecessary – the reader really should not need to know what version of phpMyAdmin a new feature was introduced in. If you really want, add another appendix listing dates of improvements, but it’s really not needed; that’s what changelogs are for.

phpMyAdmin itself has a number of new minor features that are detailed in the new book. For example, exports (SQL dumps) can be done to Texy! text format, the search wizard has been improved to allow searches for empty/non-empty fields. Support for the PBXT storage engine is added, public query bookmarks, the default browse view’s query can be customised

There are a number of major features which also make their debut here. New features include database partitioning, scheduled events, streamable blobs (for videos, etc). I’m looking forward to making use of streaming blobs!

Things that are not improved

The table of contents is even longer. At 13 pages (versus 12 last year), I still feel it’s too large. My comment last year was that maybe just the higher level headers should be shown, with more detailed contents at the beginning of each chapter. As an example, under the user management section, there is a header for adding a user. That should be enough. Instead, we then have headers describing the username, the password, the hostname, etc. That sort of thing makes the front of the book very heavy. I feel that most readers when opening the book for the first time wonder to themselves when will the contents end and the content begin.

Most of the screenshots have been redone, but in some cases, shots which were perfectly sized in the old book have been exploded up to larger images in the new one, making them huge relative to the content they portray. For example, on page 78, the top screenshot has a total of about four lines of text in it, but takes up almost two inches of page space (and is pixelated), compared to the original on page 75 of the old book at only one inch. I can see this in a lot of cases in the new book (another is the 3 inch bottom image on 132 vs the perfectly legible 2 inch one in the old book’s page 128) and wonder if that helped to add to the number of pages. The new book has 326 pages versus the old book’s 318. On the good side, in some cases, the new screenshots reduced the size of the old ones.

I didn’t mention it last year, but remember puzzling over it at the time. The last part of the Troubleshooting appendix (chapter 20 back then) discusses future enhancements to phpMyAdmin, but the goals are very vague. “improved support of mysql”, “internal code improvements”; these should not be considered goals – they should be considered givens! Besides which, it’s not productive to discuss future events that may or may not happen. They’re not available yet, so shouldn’t be written about in a manual which is about /existing/ work.


I noted a number of improvements, and a number of failures. The improvements outnumber the failures. Each edition of this book gets better and better.

If you are new to phpMyAdmin and are looking for a book, I really do recommend buying this.

bootnote: I have my own Packt book coming out in a few months. I hope that reviewers of that book (PHP And jQuery) will be as critical as I try to be in my own reviews – I feel that criticism is good, and can only help to improve future editions. This year’s edition of Mastering phpMyAdmin is better than last year’s, and I feel that it is because the author was receptive to criticism and improved his book based on it. I hope I can be just as receptive when my own time comes!


Okay, I succumbed to the temptation and got one.

A number of annoyance have presented themselves already, in just the few hours that I’ve owned it.

First off, when you get the thing, it’s in a fancy box with all the bits and pieces in it. I took all of the bits out, and found a nice rectangular cardboard box which when opened, held the documentation. I took out the documentation and read through it, discarding the box. Couldn’t figure out how to install the SIM card into the machine, as the documentation did not mention it anywhere. After an hour or so of puzzling over it, I finally noticed that the documentation box, which I had discarded, had a weird little diagram on it, which when deciphered, explained how to do it. Way to go Apple – in this case, I did RTFM, but TFM didn’t have the instructions I needed.

Secondly. After going through the jumpy-hoopy thing of filling in a form and waiting 24 hours to be allowed to own the machine (for some reason) and then waiting another hour for the receptionist at the shop to finally get through to O2 to activate the SIM, I was just picking up everything and the guy said “ok, now you just need to activate it through iTunes”. Excuse me?? It’s a fucking phone! I can’t get iTunes running on any of my computers at home anyway because I don’t have anything that runs Windows or Mac! I spent hours trying to get Wine to install iTunes, but finally had to give up and do it on an old WinXP machine in the office the next day.

Then, I wanted an SSH client for the thing. There is a cool store for the iPhone called appStore, and there were a number of SSH clients in there. In order to get one of them, though, you need an account and some cash.

First off, I tried to just create an account. This went okay, up until the point where iTunes asked what my credit card number was. I don’t have a credit card, and don’t want one. After a while, I figured out that the only way to get an account for free (or at least, without giving Apple credit card details), is to apply to download an app which is specified as free – for some reason, in that case, Apple adds a “none” option to the list of payment methods.

So I had an account, but still couldn’t pay for anything. Apple claim that they accept PayPal, and even supply instructions on how to do it. Unfortunately, it falls down immediately, because step two says to click Edit Credit Card or Add Credit Card in your iTunes account page, but those links don’t exist! Maybe they exist if there is already a credit card attached to the account, but that defeats the entire purpose!

But it’s a nice phone, really.

jQuery 1.3 With PHP

Last year, I did a few reviews of books by Packt Publishing. This year, they got their own back – Packt have asked me to write a book for them called jQuery 1.3 with PHP.

The book is aimed at experienced PHP programmers who are interested in adding a bit of client-side magic to their sites. jQuery is used because it’s damned powerful, and you can get some very cool results without too much work.

The server-side code will only be described, and examples will be provided for illustrative purposes – the real target of this book is the client-side and how it interacts with the server.

The chapter list has been agreed, although there may be scope for adjustments as the book progresses. Here’s what we have:

  1. jQuery and PHP
  2. Quick Tricks
  3. Tabs and Accordions
  4. Form validation
  5. Image and file management
  6. Data-tables
  7. AJAX-based form submission
  8. Drag/Drop
  9. Optimisation

The chapters are a little more exciting than you may think. For example, Drag/Drop will cover cool tricks like cropping/resizing images, and Data-Tables will include inline editing of the content of the tables.

The time-table suggests that the book may be completed by late August – not sure when it will be out, but I’m guessing October or so.

As a project for the book, I’ll be writing an open-source newsletter system, which will demonstrate all of the code described in the book.

review: Pro PHP – Patterns, Frameworks, Testing and More

Author: Kevin MacArthur, Publisher: APress

Overview: this book is absolutely jam-packed with information useful to the medium-advanced PHP coder. SPL is described over a few chapters, and a quick intro to Zend’s MVC framework is provided. Of particular interest to me were the final chapters, to do with certificate-based authentication, and a chapter near the beginning describing the upcoming features of PHP6. Great book – I really enjoyed it.

Technically, this book is hard to fault. Kevin is very knowledgeable about his stuff and puts across that knowledge easily. It was a real pleasure to read. There were a lot of things in the book that I had only the vaguest idea about before hand – like Phing and Xinc – I will definitely be sitting down to read more about those techs when I get the time.

The book covers SPL, MVC, PHP6, and discusses issues such as continuous integration, web 2.0, source repositories, and digital certificate authorisation.

Kevin states at the beginning that this book was written for advanced PHP developers. I would posit that the book should be given to moderate developers who are looking to develop their project management skills – a lot of pages were devoted to tools and methods that are very useful for managing medium to large projects (continuous integration, MVC).

It is very hard to find fault with this book, but I’ll do my best!

While the title of the book mentions “frameworks”, only the Zend Framework is actually looked at. Not a single other framework was named, although it was mentioned that they exist. I think this is just not on – at the least, Kevin should have provided a few reasons why he chose to describe Zend over everything else. I was looking forward to reading more about such things as Cake, Symfony, et al.

The testing and continuous development sections were not long enough – the author practically raced through the description of continuous integration and did not spend much time on it. I was hoping for some discussion on such issues as keeping databases uptodate throughout development. In a book with this much information, it’s hard to focus on everything, but I think more time should have been spent on this crucial problem in development.

The “web 2.0″ section covered the JavaScript XMLHTTPRequest object but not much mention was given to the higher-level stuff such as JavaScript frameworks and integration of those frameworks with PHP – I like the Sajax and Xajax libraries myself. Other people might go for the more mainstream (and complete) frameworks such as Dojo, MooTools and jQuery. Either way, I think this section should have included more integration with PHP or have been left out altogether.

SOAP was covered in the WebServices section, but not much mention is given of XML-RPC, REST, etc. It’s also not mentioned that JSON (my favourite object representation, described elsewhere in the book) can be used as a transport language for WebServices as well. This appears to be the same problem as the Zend section – Kevin chose a single tech to describe, without giving a good reason why he chose that or even what the alternatives are.

Forgetting about those minor details, I’d have to admit that that was a damned fine read. I would buy the book, and if you’re a serious PHP developer, so would you too.

book review: Learning PHP Data Objects

Overview: Learning PHP Data Objects, by Dennis Popel, is an introduction to PDO, which walks through the building of a believable test example – a library manager for your home library. Each chapter introduces a new facet of PDO and shows how to rewrite the appropriate parts of the application to slot the new ideas in. Very clear and easy to read. Non-PDO subjects are appropriately kept to the appendices.

I really couldn’t find very much about this book that I didn’t like. Ignoring the appendices, the book is 154 pages purely devoted to teaching PDO through examples, including error handling, working with BLOBs, even the creation of the M in MVC (Models).

I mentioned MVC there. One of my gripes with most tutorials of MVC is that they introduce the concept simply, then provide pages and pages of code with the end product which is “hello world”. Why I should go to all that trouble instead of simply writing <php echo 'hello world'; ?> to the screen usually escapes me. Dennis, however, concentrates solely on the Model and shows exactly why it’s a great idea. I think some more separation of concerns would have been better (don’t mix Author and Book SQL in the same object, for example), but the ideas were all good.

I think that if Dennis was going to show how the Model works, he should also have gone a little further and showed an example of an Active Record pattern as well. But I guess the point of showing MVC was more to show /an/ example of abstraction of the DB code, and that was sufficient.

The book covers a Library manager application all the way through from conception to implementation, demonstrating at all points that the code works with SQLite and MySQL (and by implication, all other DBMS’s) with a change of only the connection string.

Possible problems are explained clearly and solutions are provided. For example, Dennis explains why, after you compile the query select * from books, PDO (and indeed the database itself) does not know how many rows it will return. A solution, in the form of a very smart getRowCount() function shows a query-agnostic method for counting results of an arbitrary line of SQL.

Other areas that are covered in the book include error-handling, prepared statements and transaction-handling.

PDO can handle Prepared Statements even if the underlying DBMS cannot handle it, so it is possible to write your code in a cross-platform way. Examples of why you should use this are provided. One of the examples shows an efficient way to handle insertion or updating of a table using the same parameters for both cases, with the row-handling function deciding whether to use update or insert based on whether an ID was provided.

I feel the Transactions section could have been expanded a bit further. It is not explained how PDO handles this for DBMS’s that don’t internally support transactions, and I wouldn’t like to assume that they work all the time, only to find after deleting critical data that it’s not supported.

Overall, I enjoyed reading this book. Dennis is a good writer and I think he explained his thoughts very clearly.

On an aside, my four-year-old son Jareth loves Packt Publishing‘s books. Sometimes when I go to read another chapter, I need to covertly steal the book I’m reading back from him. For a while, he made it a bed-time ritual to grab all the Packt books he could find around and bring them up with him to read in bed. I think he loved the screen-shots and the frequent code samples. He’s high-functioning autistic and likes literary constructs, and programming books are perfect for him in that regard. Thanks Packt, you’ve made my son (and therefore me) happy.

review: Object-Oriented Programming in PHP5

by Hasin Hayder, Packt Publishing

In short: a very good concise introduction to OOP. I’ll be keeping this on my desk for a while. The language use is strange but the code examples and the spread of topics make up for that in spades. This book has a very broad scope, but is clear in the essentials. If you’re looking for an introduction to Objected Oriented Programming in PHP, I’d recommend this one.

The Good

The book does a good job of introducing PHP objects. I’ve done OOP in C++, Java and PHP, and found Hasin’s descriptions easy to read.

I liked that code examples are provided for almost every discussed idea. In fact, in some cases I found that the code was so readable it explained things that were not stated in the surrounding paragraphs.

I’ve been coding in PHP since the 90s and avoided doing a lot of OOP because I was aware that it was not widely available until PHP5 came out. Only recently, the GoPHP5 project started pushing for the adoption of PHP 5.2 as a minimum. As a result of that, I’ve started assuming a base level of 5.2 in my own work, and that allowed me to work properly with objects.

This book, then, is a good reference to keep on my table as I update my own coding style.

It has a clear discussion of PHP’s handling of objects, with details on probably all aspects of it – Hasin certainly knows more about OOP in PHP than I do, so I can’t find any faults!

Following the description and examples of Objects in PHP5, the book then moves onto Patterns, providing a short description of the major patterns. Good programmers will already be aware of these, but it is always good to have a reminder.

I’ve never done Unit Testing (yes, bad me – I’m a fan of Selenium, though), so the chapter on Reflection And Unit Testing was perfect timing for me – I’ve been pressuring myself recently to get into unit testing, and this was the perfect way to start. A quick overview of how to unit-test objects was provided. I had a few questions at the end of the chapter, but they’re probably best left for a book specifically on unit testing.

The SPL chapter was a little surprise for me. I wasn’t aware of these classes in PHP5. Although, considering my knowledge is bassed mostly on Procedural Programming and the manual, which is mostly Procedural, this is not surprising. The book described some objects such as RecursiveDirectoryIterator and SPLFileInfo which I found immediate application for in my own work.

There is also a chapter on MVC. I’m not really into MVC, so was interested to see if he could convince me that it was better than the methods I currently use, but no, I’m still not convinced.

The Bad

There are a number of stated assumptions in the book. For example, OOP is implicitly better than all other methods of programming. On page 12 of the book, a number of “benefits of OOP” are noted. Each of those benefits can apply to Procedural Programming as well. Not enough thought went into convincing the reader that OOP is better. I agree that OOP is better, but the arguments written in the book are not strong enough.

There are other assumptions in the book – that MD5-hashing a password is “the best” way of storing a password, that coders should never code from scratch as almost everything as already been written (he then goes on to write an MVC implementation from scratch…). Each of these assumptions detracts slightly from the readability of the book because it makes the book read as a personal opinion instead of an objective discussion.

Also, I didn’t like the frequent references to PHP4. let’s forget the past and concentrate on 5. The book is written for PHP5, so there should be minimal discussion of PHP4 in it. Funnily, on page 13, this line appears: “In PHP5, objects are a lot more different than an object in PHP4. We will not discuss the details of this”. Two pages later, we have the sub-chapter heading “Difference of OOP in PHP4 and PHP5″. Some people may disagree with me, but I think that should be left to an appendix – the author should assume that the reader is coming to the subject with no knowledge at all. Describing old and new behaviour is confusing. Stick to the new.

I feel that a chapter should have been written which describes the conversion of an existing script from Procedural to OO. While it’s not difficult to do, it would have helped to explain the thoughts behind OOP.

The Ugly

The code samples were not readable enough, in my opinion. There were commented-out lines of code which should have been removed before publishing, and the indentation was non-standard and inconsistent.

The language used is difficult to read. I understand that Hasin is from Bangladesh and that English is probably not his first language, but as this book is written with an English-speaking reader in mind, the language should have been read over and corrected where it was non-standard.

Near the beginning of the book, Hasin lists off a short list of coding conventions to use. Throughout the book he then breaks most of them in his code. Granted, this doesn’t affect the /correctness/ of the code, but it is distracting when noticed.

The Table Of Contents doesn’t match the book! If you are looking for something using the TOC, then you need to add 4 to the page number it mentions. The Index is even worse, in that the page numbers are off /on average/ by about 3 pages.

It might come across from these comments that I didn’t like the book, but that’s not true – I enjoyed reading it and learned quite a bit from it. No review is complete, though, without some criticisms, and I just happen to be good at criticising.

I will re-read bits of the book over the next few weeks, and would recommend it to anyone that’s starting out in OOP in PHP.