Download the PHP package badoo/phpcf without Composer
On this page you can find all versions of the php package badoo/phpcf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package phpcf
Short Description The formatter was created to basically only modify whitespaces, for example line feed, tabs, spaces, etc.
License MIT
Informations about the package phpcf
phpcf
⚠️ The project is abandoned. Instead of adding support for PHP8+ we have decided to switch to PHP_CodeSniffer. ⚠️
The formatter was created to basically only modify whitespaces, for example line feed, tabs, spaces, etc. It means that phpcf does not replace similar utilities like PHP Code Sniffer (phpcs) or PHP Coding Standards Fixer (http://cs.sensiolabs.org) by Fabien Potencier. The utility supplements others and does all the "dirty work" with whitespace characters. It is worth noting that our utility respects the initial file formatting and only changes whitespace characters that do not follow the chosen ruleset (some utilities remove all whitespace first and reconstruct file from scratch, which is not necessarily what people want).
Our utility is extensible and supports arbitrary style sets. You can define your own formatting style pretty easily to replace Badoo formatting standard that is a bit different from PSR.
Below is a little usage example.
- "phpcf apply
" formats the specified file - "phpcf check
" checks that formatting is correct and returns non-zero exit code when file is not formatted properly
Our utility is also capable of formatting part of file. To do so, you need to specify line number ranges after a colon:
It is worth noting again that phpcf is designed to only change whitespace characters and to do the most simple tasks such as:
- replacing "<?" with "<?php"
- removing extra closing tag from the end of file
- change cyrillic letters to english in function names
- expressions that are aligned manually using spaces are not touched
The formatter works as a finite state machine with rules that are set by user instead of using hard-coded replacements. We supply the default config that follows Badoo formatting rules. So if you would like to get automatic "var" -> "public" replacement or similar we suggest looking at PHP-CS-Fixer. The latter does not really touch whitespace characters but it can do much more sophisticated replacements than our utility.