A magazine about programmers, code, and society. Written by and for humans since 2018.

Josh Lockhart & Phil Sturgeon

The infinite flexibility of software is not without some major disadvantages. That is the main reason why we, software practitioners, crave so much any kind of information about “the best” or “the right” way to build, test, deploy, and maintain our systems. Yes, our craft is already complicated enough, and we are not even talking about the human complexities like office layouts, employment shenanigans, dress codes, and whatnot. In this occasion we are going to talk about a resource that fights, with facts and examples, the battle of excellency in the world of PHP.

In the pages of this “Library” section we have often covered major books aiming to provide such guidance; for example Michael Feathers’ “Working Effectively with Legacy Code”; Scott Meyers’ “Effective C++”; Amy Brown & Greg Wilson’s “Architecture of Open Source Applications”; Jenifer Tidwell’s “Designing Interfaces”; David Kadavy’s “Design for Hackers”; Steve McConnell’s “Code Complete”; Douglas Crockford’s “JavaScript: The Good Parts”; and others. So many, actually, that we have added them all to a new category in this blog, called “Best Practices”, which you can access at any time through the main menu.

Of course, this month’s entry, Josh Lockhart & Phil Sturgeon’s excellent “PHP: The Right Way” falls into this category. Solely mentioning the names of these two authors, however, I am acutely aware of the implicit, tacit, long list of contributors that have provided corrections, translations, reviews, and more to this work. Said list even includes some university professor like Kris Jordan. But please understand that not enumerating them all here does not, in any way, diminish the relevance of their contributions. Let us just say that Josh and Phil are the instigators of this book, and not just the initial authors.

(And knowledgeable initial instigators they are, oh yes: Josh is the author of “Modern PHP”, a book published by O’Reilly in 2015, and the creator of the Slim Framework, a favorite choice of mine in the world of PHP frameworks. Phil has worked as a consultant for various tech companies, but most importantly, he is behind the Protect Earth project, a commendable reforestation effort we can only salute and support.)

As it stands, “PHP: The Right Way”, currently available on Leanpub in PDF or EPUB formats, and hosted on its own website for instant access, is the fruit of an open-source project hosted on GitHub with (at the time of this publication) more than 300 collaborators.

Now that is what I call a community.

Why read this? Well, to put it bluntly, this book aims to mark a milestone, leaving some classic books behind, like Rasmus Lerdorf’s own “PHP Pocket Reference” published by O’Reilly in 2000 (you can still read an excerpt from it on the Internet Archive, by the way) or Paul Hudson’s “PHP in a Nutshell” from 2005 (is it the same Paul Hudson that nowadays hacks with Swift?) That “old PHP” is the default impression most developers have, particularly those who might have worked with the language and ecosystem decades ago, not realizing 23 years later that both had (thankfully) evolved for the better. Time for a wake-up call, if you will.

This book aims to point you towards what is considered the “State of the Art” and “Crème de la Crème” of tooling, practices, and patterns for your PHP code in 2025. From testing, to caching, to dependency management, to OOP, to internationalization and localization, and even to containerization, you will find enough information to help you along the way. This is a live document, updated every so often since its first version in 2013, translated to 20 languages other than English, and continuously evolving. Which, let us be honest, also explains why there is no printed version available–and rightfully so.

(The value you could derive from “PHP: The Right Way” assumes, of course, that you have not fallen prey of the latest fads around “vibe coding”, in which case, well, good luck with that. The whole premise of this magazine is very simple: that you care about your craft enough as to understand what is going on behind the scenes of the code that you put into production. That is all.)

PHP in 2025 is a fabulous beast with a thriving ecosystem, powering most of what you see on the Internet. This month’s Library book, “PHP: The Right Way” is precisely the most appropriate choice to either discover or to get re-acquainted with PHP after a long hiatus.

We recommend coupling the lecture of this book with more resources. Books such as the 2023 “PHP Cookbook” by Eric A. Mann. Online resources, like “Learn modern PHP” by the prolific Daniel Opitz, or “Clean Code concepts adapted for PHP” by Piotr Plenik. And modern best practices documents and manifestos, such as “The Twelve-Factor App”, “The Reactive Manifesto”, “Rootless Containers”, “Keep a Changelog”, “Oh Shit, Git!?!”, “Reproducible Builds”, and the always useful “Bobby Tables: A guide to preventing SQL injection”.

Oh, and if you excuse the shameless plug, and as mentioned previously, many of the books in the “Best Practices” category of this magazine could also be a welcome lecture in your road to betterment.

Cover photo adapted from the EPUB file.

Back to top