PHP The right way

Today I learned about PHP The right way. Whilst I am a front-end developer who focuses on JavaScript, CSS, HTML, UX, design etc etc, I am still responsible for writing PHP every now and again. That can be Wordpress themes or plugins, login systems and in the past I have written basic e-commerce. PHP is still my server side language of choice for my own projects.

I have made effort in my JavaScript to try to follow some practices - ESLint, Prettier for code formatting, use Babel, learn design patterns and more. But my PHP code style has always remained pretty procedural. Import some classes, set some variables, handle form input, and then write to a view using a template language (if possible). There is always inevitably a bunch of if/else statements. I never really feel like I am writing as clean code as my JavaScript and that my PHP knowledge is probably a bit dated.

I was reading about PHP security on Paragon Initiative and it immediately mentions their e-book PHP The right way. I am going to read it and see what I can do better when writing PHP in the future. I have dozens of these sort of documents for JavaScript, so it is good to have a more prescriptive guide.