PHP coding conventions? [closed]

試著忘記壹切 提交于 2019-11-27 03:53:58

问题


Where can I find PHP coding convention references for PHP coding standards?


回答1:


I suggest Zends Coding Standard: http://framework.zend.com/manual/1.12/en/coding-standard.html




回答2:


The PEAR coding standards have been around for a while now. I believe they are the default for the PHP code sniffer.




回答3:


PSR-2: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

(Excerpt)

This guide extends and expands on PSR-1, the basic coding standard.

The intent of this guide is to reduce cognitive friction when scanning code from different authors. It does so by enumerating a shared set of rules and expectations about how to format PHP code.




回答4:


The ones from Zend are very good.




回答5:


I think there is no official coding standard. I think the ones from Zend are used very often, because they are the company who develop php. But symfony for example, which is a large php mvc framework, has it's own conding standards.




回答6:


I would also like to mention that another popular framework, CakePHP, has their own conventions.

http://book.cakephp.org/view/22/CakePHP-Conventions




回答7:


I would recommend looking at the FLOW3 Coding Guidelines. It is very good.



来源:https://stackoverflow.com/questions/1863790/php-coding-conventions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!