备受推崇的PHP样式指南列表? [英] List of highly-regarded PHP style guides?

查看:149
本文介绍了备受推崇的PHP样式指南列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在抖动我的编码习惯,并一直在玩各种各样的编码风格的方法...例如使用方法调用括号之间的空格和它们包含的参数,如何处理多行数组定义和方法调用等。

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.

推荐答案

PHP标准建议 PHP框架互操作组是一个很好的资源。 AFAIK的标准受到高度评价。

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.

我想说的是基本的PHP编码,特别是 PSR- 1和PSR-2非常值得一读

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


PSR-2的目的是为PHP代码提供一个单一的风格指南,

PSR-2′s purpose is to have a single style guide for PHP code that results in uniformly formatted shared code.

到目前为止,有四个公认的标准建议:

So far, there are four accepted standard recommendations:

  • PSR-1: Basic Coding Standard
  • PSR-2: Coding Style Guide
  • PSR-3: Logger Interface
  • PSR-4: Autoloader Standard (PSR-0 alternative)

已弃用:

这篇关于备受推崇的PHP样式指南列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆