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 (http://creativecommons.org/licenses/by-nc-sa/3.0/), 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: https://github.com/philsturgeon/phptherightway-book
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 http://www.autismspeaks.org/ in the near future though, as I would certainly switch the donations of my Building APIs You Wont Hate https://leanpub.com/build-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.
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's also a DX person at Diffbot. 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 RMRK.app.