Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
125 views
in Technique[技术] by (71.8m points)

List of highly-regarded PHP style guides?

I've recently been shaking up my coding habits and have been toying with various approaches to coding style... things like using a space between method call parentheses and the parameters they contain, how to deal with multi-line array definitions and method calls, etc.

I'm wary of creating my personal flavor of everything, though, and want to skim through some well-regarded "authoritative" style guides. Which ones should I look at? I've had a hard time finding much other than the Zend guide.

question from:https://stackoverflow.com/questions/3638083/list-of-highly-regarded-php-style-guides

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The PHP Standards Recommendations by the PHP Framework Interoperability Group are a good resource. AFAIK the standards are highly regarded. They attempt to be a collection and unification of what different frameworks have decided to use as their own standards.

I would say for basic PHP coding, especially PSR-1 and PSR-12 are well worth a read.

PSR-2′s purpose [was] to have a single style guide for PHP code that results in uniformly formatted shared code. [The PSR-12] specification extends, expands and replaces PSR-2, the coding style guide and requires adherence to PSR-1, the basic coding standard.

There are several accepted standard recommendations.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...