Goldstandard-for-PHP
Goldstandard-for-PHP copied to clipboard
A PHP CodeSniffer ruleset known as "Koch's Goldstandard for PHP".
Koch's Goldstandard for PHP - A Coding Standard
This repository contains a set of code sniffs for PHP_CodeSniffer. image:https://travis-ci.org/jakoch/Goldstandard-for-PHP.svg["Build Status", link="https://travis-ci.org/jakoch/Goldstandard-for-PHP"]
This standard enforces:
- https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md[PSR-0], https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md[PSR-1] and https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md[PSR-2]. The standards were approved by the https://github.com/php-fig/fig-standards[PHP Framework Interoperability Group].
- the removal of old and deprecated PHP functions (This is helpful, when working with legacy code.)
- the usage of faster functions. Which in fact are premature or micro optimizations. Uh, oh! That's BAD for sure :)
Requirements
PHP 5.3+
PHP_CodeSniffer (http://pear.php.net/package/PHP_CodeSniffer)
Installation
- PHP_CodeSniffer is installed via Composer
- Clone this repository
- +git clone https://github.com/jakoch/Goldstandard-for-PHP.git Goldstandard+
- Create a symlink PHP/CodeSniffer/Standards/Goldstandard pointing to the Goldstandard directory
- +ln -s [somewhere]/PHP/CodeSniffer/Standards/Goldstandard /Goldstandard+
Usage
- Use the coding standard with +phpcs --standard=Goldstandard+
- You might also set it as default standard +phpcs --config-set default_standard Goldstandard+
- If you didn't symlink or install it, then reference it by path +phpcs --standard=path/to/Goldstandard path/to/code+
IDE Integration
NetBeans
http://plugins.netbeans.org/plugin/40282/phpmd-php-codesniffer-plugin
PHPStorm
http://www.jetbrains.com/phpstorm/webhelp/using-php-code-sniffer-tool.html
Zend Studio
http://files.zend.com/help/Zend-Studio/content/working_with_php_codesniffer.htm