PHP The Right Way: The Book

Share this article

The web development world is vastly overpopulated by newbies, especially in easy-entry languages like PHP. The percentage of people who tack on “PHP dev” to their CVs after having been only through a single tutorial or having built a single WordPress blog, is shockingly high. When big-shot CEOs outsource their production to the cheapest freelancer they can find, it’s no surprise the project fails or gets delayed into infinity.

This unhealthy loop is a big part of PHP’s bad reputation, because bad practices propagated by bad resources and bad developers persist in the modern world which, effectively, outgrew them. We can’t keep the newbies away, and we can’t educate the clients because most clients learn exclusively on mistakes.

Shared host environments are also to blame, because their plans seldom include the most recent version of PHP, and are, due to price and ease of use, still the preferred hosting solution for legions of newcomers. So what can we do to spread best practices?

PHP – The Right Way

PTRW is a community effort, a website built entirely around spreading best up-to-date PHP practices. It’s far from exhaustive – instead, it tries to bullet-list the things you should pay attention to, and links to quality resources where one can learn more about the various aspects it covers.

The site is regularly updated and accepts pull requests through GitHub. It’s available in several languages, and covers topics ranging from Vagrant and the built-in PHP server, to containers, dependency injection, proper password hashing, and more.

To help spread the word of proper PHP, read through the site and share it with everyone you know that as much as dabbles in PHP – the net gain is immeasurable and the lives of developers and clients both will profit from it greatly.

Those more knowledgeable among you might be wondering why I’m writing about PTRW now, if it’s been around for years. It’s because PTRW recently got published as a book on Leanpub.

The Book and EFF

The book is little more than the printed and edited PDF version of the site. It’s a 50 page manuscript with 40 pages of content you can consume, and is identical in every regard to the PTRW site as it stands at the time of this writing. Why, then, would anyone purchase it?

The book is “pay-what-you-want”, even if you don’t want to pay anything. It can be downloaded free of charge, no strings attached. However, should you decide to purchase the book (i.e. pay any sum before downloading it), 100% of the proceeds go to EFF, the Electronic Frontier Foundation.

What is EFF?

Defending your rights in the digital world

EFF is a donor funded non profit organization consisting of tech, legal and other experts. These experts come together and fight for the individual and the public in court cases against digital rights oppressors such as the US DOJ or Apple and similar. Every donation sent their way makes a new court victory possible, and helps keep one of the main defenders of our digital lives in operation. While the EFF is, unfortunately, very much US-oriented, every victory on American soil makes similar victories in other parts of the world possible, by providing local digital rights defenders with good arguments reusable elsewhere.

The Book’s Editors

The book is authored by the community, but the main drivers of the compilation and editing effort are Phil Sturgeon and Josh Lockhart. While you can get to know them at their respective websites/twitter accounts, Phil was kind enough to lend me a couple minutes of his time and answer some questions about the actual book:

  • Content-wise, what does the book offer that the site doesn’t, if anything?

    Phil: Literally nothing, its the same thing.

  • Is the book going to be an effort as continuous as the site? In other words, do you intend to keep it in sync with the site and keep it on offer at Leanpub indefinitely?

    Phil: It will be updated whenever I run a little PHP script I have locally, which converts GitHub Markdown to LeanPub Markdown.

  • How many downloads has the book seen so far? How many of those were paid? What was the average contribution?

    Phil: 411 at time of writing, but we only tweeted about it yesterday. Before that it had been sat around unannounced at had about 125 users, so that is a lot of downloads in 24 hours.

    Of the 411 we’ve had 80 people donate, with an average donation price of $3.80 USD.

  • Are there any plans to expand the content for the book version? For example, “The Basics” page is linked, but perhaps more would be to gain if it were included in the text itself.

    Phil: That sounds like it could be a good idea. I’d have to write a lot more regex for that, but yes grouping in some of the wiki content would be valuable.

  • Are there plans for a print version, depending on demand?

    Phil: I’m not sure of the legality of that. Currently the content of the book is licensed as Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (, which means we cannot use the material for commercial purposes, even if we wanted to.

    LeanPub is not an issue as we donate every penny to charity, it is still using the same license and is still noncommercial. Anything else though would be an issue.

    Obviously for a printed copy to exist we’d need to charge for it in the stores, and that would be commercial use, unless we set up some sort of non-profit organization and even then it sounds dodgy and like a lot of hard work.

    I think, for now, LeanPub will be the extent of it. If a lawyer would like to get in touch and offer his or her services to us for free then maybe that will change.

  • How about the book in other languages? Are authors of the PTRW translations free to put those up on Leanpub as well?

    They are welcome to do so. I have made my conversion script publicly available for exactly that reason:

  • What made you decide on EFF as the cause to contribute to?

    They are doing some amazing work to keep the internet free, open, and impartial. They are organizing important protests, raising awareness of sneaky stuff that most of us nerds would miss otherwise, and generally fighting in our corner.

    It also seemed a little more relevant to the content of the book than the “Shakespearean Authorship Trust” or “Liberty in Northern Korea”, even though they are no doubt worth causes.

  • Any other causes, efforts or good resources you’d like our readers to be aware of? Or bad ones they should avoid?

    I don’t think its my place to comment on wether a cause is good or bad, and I am not personally familiar with any of the other causes supported by LeanPub. I would like to see them supporting in the near future though, as I would certainly switch the donations of my Building APIs You Wont Hate to them.


PTRW is a valiant effort in making sure we’re all in sync when working with PHP. It’s a good starting point for any new PHP enthusiast, and should be the first stop of their PHP journey. Now in book form and backing a powerful cause, PTRW should contribute to the betterment of the digital world even more. Help the cause by spreading the word, contributing to the site or donating even the smallest amount – the community appreciates it.

Frequently Asked Questions about PHP: The Right Way

What is the main difference between PHP: The Right Way and other PHP guides?

PHP: The Right Way is a comprehensive guide that provides a clear and concise pathway for PHP developers to follow. Unlike other guides, it focuses on best practices, accepted coding standards, and authoritative tutorials. It also emphasizes the importance of using modern PHP, including the latest versions and features, which sets it apart from other resources.

Why should I choose PHP: The Right Way over other PHP learning resources?

PHP: The Right Way is a unique resource that not only teaches you how to code in PHP but also guides you on the best practices to follow. It is regularly updated to include the latest PHP versions and features, ensuring you stay up-to-date with the most recent developments in PHP programming.

Is PHP: The Right Way suitable for beginners?

Yes, PHP: The Right Way is suitable for both beginners and experienced PHP developers. It provides a clear and easy-to-understand guide to PHP programming, making it an excellent resource for beginners. For experienced developers, it offers a wealth of information on best practices and advanced features.

How often is PHP: The Right Way updated?

PHP: The Right Way is regularly updated to include the latest PHP versions and features. This ensures that you always have access to the most recent and relevant information about PHP programming.

Does PHP: The Right Way cover object-oriented programming?

Yes, PHP: The Right Way covers object-oriented programming in PHP. It provides a comprehensive guide to the principles and practices of object-oriented programming, making it an excellent resource for developers looking to improve their skills in this area.

Can I contribute to PHP: The Right Way?

Yes, PHP: The Right Way is an open-source project, and contributions are welcome. You can contribute by submitting pull requests on GitHub or by providing feedback and suggestions.

Does PHP: The Right Way cover PHP frameworks?

Yes, PHP: The Right Way covers a variety of PHP frameworks, including Laravel, Symfony, and Zend. It provides a comprehensive guide to using these frameworks, making it an excellent resource for developers looking to expand their skills in this area.

Is PHP: The Right Way available in other languages?

Yes, PHP: The Right Way is available in several languages, including Spanish, French, Italian, and German. This makes it a valuable resource for non-English speaking PHP developers.

Does PHP: The Right Way cover PHP security?

Yes, PHP: The Right Way covers PHP security in detail. It provides a comprehensive guide to securing your PHP applications, including best practices and common security pitfalls to avoid.

Is PHP: The Right Way free to use?

Yes, PHP: The Right Way is a free resource. It is available online for anyone to use, making it an accessible and valuable resource for PHP developers of all levels.

Bruno SkvorcBruno Skvorc
View Author

Bruno is a blockchain developer and technical educator at the Web3 Foundation, the foundation that's building the next generation of the free people's internet. He runs two newsletters you should subscribe to if you're interested in Web3.0: Dot Leap covers ecosystem and tech development of Web3, and NFT Review covers the evolution of the non-fungible token (digital collectibles) ecosystem inside this emerging new web. His current passion project is, the most advanced NFT system in the world, which allows NFTs to own other NFTs, NFTs to react to emotion, NFTs to be governed democratically, and NFTs to be multiple things at once.

best practicebookgithub bookjosh lockhartleanpubphil sturgeonPHPphp the right wayptrwself-publishthe right way
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form