PHP is not a programming language

Jacem Chaieb
Published in
4 min readJan 3, 2019


Over the last years, PHP hasn’t gained a very good reputation, instead it has always been criticized and frowned upon. Some even went as far as to not consider it a programming language.

We’ve all been there, you hear the word “PHP” and the first thing that comes to your mind is a messed-up code where everything is mixed together, just take a look at the following mashup:

In one file, you can see session management, HTML tags, CSS formatting and most of the times it will also include some SQL queries and file system management. That can be called anything but decent code, it’s a nightmare in the web world!

The sad part, though, is that people tend to generalize this and blame PHP instead of the developers.
PHP became famous because of its low entry level, any new developer will find it easy to start coding with due to the fast feedback they get and to huge community around it, also because PHP has no big requirements a developer can’t have, you put any *AMP stack and you’re good to go (LAMP, MAMP, WAMP respectively for Linux, MacOS and Windows). And that type of code we’ve just seen tend to be the first step of a new PHP learner.

In March the 1st of 2012, a PHP dependency Manager inspired by NPM has seen the light publicly under the name “Composer”, which was developed by Nils Adermann and Jordi Boggiano.
Before the appearance of Composer, every PHP developer had a set of files and libraries to include in each and every project, in a way, it was managing dependencies and packages manually and it was a total chaos, very little to non-existent versioning, deprecation, redundancy, you name it…

But with Composer, a lot has changed, now you can define your exact requirements with versions ranges (very important in a SemVer based environment) and be sure to reinstall the exact same versions every time, composer manages all the hassle for you and autoload all the libraries, all you need is to include one single file and you’re good to go.

With that in mind, PHP is becoming a well established language with a huge community around it and very strict set of standards called PSR.

PSR (PHP Standard Recommendation) is a PHP specification published by the PHP Framework Interop Group. It serves the standardization of programming concepts in PHP. The aim is to enable interoperability of components and to provide a common technical basis for implementation of proven concepts for optimal programming and testing practices. The PHP-FIG is formed by several PHP frameworks founders.

Developers are not asked to strictly stick to PSRs, and that’s due to the effort that it may take and to avoid introducing breaking changes to current code. But it’s recommended that new versions and projects follow the maximum number of rules, since it can be a bit hard to apply all of them, it depends on the project, the developers, the team, …

Some PSRs are so simple that they can even be automated, such is the case for PSR-1 and PSR-2 describing how the code should be written, these standards can be checked using PHPCS (PHP Code Sniffer) and errors can be even corrected automatically, and it’s well integrated in most IDEs today.

Other are a little advanced and may be hard to assimilate, and are more oriented to framework creators rather than developers, taking the example of PSR-11, describing a very simple interface with only two methods to create a container. But before you dive into that, you’ll need to have a SOLID experience (no puns intended) and deep understanding of OOP concepts and best practices, such as dependency injection and inversion of control etc (S.O.L.I.D design principles are a good starting point for that, even though it’s a little opinionated).

So, today, PHP frameworks are mostly united thanks to FIG and to the whole community. It’s becoming more and more organized and still growing rapidly. And just for the sake of comparison, I will leave you with the following “good” PHP code sample:

Originally published at on August 4, 2018.