Is there any kind of PEP8 for PHP?

Asked

Viewed 82 times

-1

Guys there is some type of pep8 for PHP that helps to write more clear code ?

  • Hello Matheus Santos, welcome to the site. Have you looked at the tour? https://answall.com/tour I also recommend taking a look => https://answall.com/help/dont-ask

1 answer

2


Yes (although it is not official PHP), there is the PSR, at the moment exist:

There are still those that are in "review" and have not necessarily been accepted yet.

The basic code style is the PSR-1 and PSR-2, the rest are styles for more specific things

A personal opinion about all this is that I find the PSR-1, PSR-2 and PSR-4 reasonable, but I really think most exaggeration follow blindly, PHP is a scripting language, many things can be done in a simpler way to standardize many things is a job that sometimes borders on blind exaggeration, really do not have to do (as I say in personal opinion), I chose to write in PSR-1 and PSR-2 by personal option, but the PSR-4 I chose simply by for a framework I developed and yet not use for all cases, even the use of object orientation without need sounds like exaggeration, and people tie themselves in to excuses that leave something more organized.

The issue is not Oop is better procedural (or otherwise), the problem is the unnecessary use of something that can sometimes be simplified, I see a lot of people writing things based on other languages like Java thinking they’re going to make something easier and when they spend time they notice that it was a giant job that will only be used in that place, when it doesn’t complicate more.

To summarize, it’s not because they wrote the Psrs that you should use.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.