TechBookReport logo

Keywords: PHP, Hack, programming languages, web development

Title: Modern PHP

Author: Josh Lockhart

Publisher: O'Reilly

ISBN: 978-1491905012

Level: Introductory - some previous PHP assumed

Verdict: An interesting, fast read, but could have done with more emphasis on the language side of things


All computer languages evolve over time or shrivel up and survive as museum pieces of interest only to academics, historians and a few die-hard fans. The funny thing is that there are some languages that have evolved in directions that few would have been able to predict. Two very good examples are JavaScript and PHP, which have both evolved and matured and have established themselves as central players in the modern programming language ecosystem. Who could have imagined that the collection of CGI scripts that Rasmus Lerdorf christened Personal Home Page would end up evolving into the current PHP platform that powers a big chunk of the web, including Facebook.

For those of us who have not looked at PHP for some time the changes in the language are quite significant, and are matched by a maturation in the broader platform and practices that have been adopted by the PHP community. 'Modern PHP' is a book that brings the reader up to speed on these changes - going far beyond purely language constructs to look at standards, development environments, best practices, testing, deployment, profiling, alternative virtual machines and more.

The starting point though is the language itself. The first quick chapter gives a whistle-stop historical run through and then it's on to the second chapter devoted to the language changes. Topics include name spaces, interfaces, traits, generators and closures. This is where you get to see that PHP has indeed kept up with other modern languages - though in a later section of the book you learn about the Hack language which takes PHP further towards languages such as Java and C#.

Part two of the book is entitled Good Practices - though in point of fact the first two chapters of this section - which cover components and frameworks - really ought to be considered with the language changes as they fundamentally change the way you program in PHP. It's chapter five, which is actually entitle 'Good Practices' that you really get to deal with good practices? This means things like handling user input, passwords and hashing, multi-byte strings, database access through PDO, dates and times and so on. In other words some of the core issues that nearly every data driven PHP application has to deal with.

Part three moves on the platform side of things. This includes hosting, provisioning, tuning, deploying, testing and profiling. The PHP virtual machine and Hack also get a chapter, as does the topic of supporting the PHP community. While interesting, this section of the book is more likely to appeal to the DevOps out there than the developer who never has to poke around at the server level. But don't think this is uninteresting; it's just that for a pure dev it's likely that the earlier parts of the book are going to be the more interesting.

Overall this is an interesting read with a wide range of content. It could have done with more emphasis on the language aspects and more in the section on good practices. The additional material on picking a hosting plan and the ins and outs of different types of server platform really could have gone in an appendix as it's unlikely that most developers are that interested or have that much say in the choice of underlying platform. Still, overall this is a good choice for a reader looking for a PHP update or a quick refresher course.

Hit the 'back' key in your browser to return to subject index page

Return to home page

Contents © TechBookReport 2015. Published April 27 2015