Even with all the AWESOME, BEAUTIFUL, FUNCTIONAL and LIGHTWEIGHT frameworks out there, PHP is still king (as far as use case goes). PHP is used by** 81.9%** of all the websites whose server-side programming language according to w3 Techs.
PHP is easy to get up and running; and simply start coding. After learning HTML and CSS I learned PHP. I created my first form and PHP script with relatively no previous coding experience. The idea of separating ‘code chunks’ was very exciting and poorly executed.
I, like many other ‘newbie’ developers, wanted to start making money so I went online and looked up jobs that involved the three new skills I learned. I found WordPress. WordPress accounts for 18.9% of all websites being used. It’s fair to say I barreled through my first website with little to no grace and a lot of copied code I found from Google. I tried to understand everything I was copying but there ended up being a hodgepodge of thoughts, standards and suggestions, many contradicting one another.
I wasn’t the only developer to have learned this way, nor to have coded this way, leading to a web that littered with poorly coded PHP (markup inside of logic, inside of markup inside of ‘log-mark-ic-up‘).
FIG was tired of this problem as well.
The idea behind [FIG] is for project representatives to talk about the commonalities between our projects and find ways we can work together. Our main audience is each other, but we’re very aware that the rest of the PHP community is watching. If other folks want to adopt what we’re doing they are welcome to do so, but that is not the aim.
Fig created standards for PHP called PSR. They are great, they are not required, but they are a standard. PSR stands for “PHP Standards Recommendation.”
There are now 6 standards in PSR (PSR-0 through PSR-7 with no more 5 or 6) each dedicated to standardizing a certain aspect of PHP code. For example PSR-1 focuses on a basic coding standard. You may have heard don’t use:
but use instead:
That is part of the PSR-1 standard.
PSR-2‘s purpose is to have a single style guide for PHP code that results in uniformly formatted shared code.
What’s the point?
PHP is also an awesome, beautiful and functional language. It is extremely powerful, but _with great power comes great responsibility; _according to Uncle Ben anyway. PSR helps the PHP community work together more efficiently and helps lessen the effect of the poor code that’s out there (hopefully including code from the younger me). Personally it sounds like PHP-FIG is doing a pretty good job of centralizing PHP standards.
More info at www.php-fig.org/