phpfmt / fmt
K&R and phpfmt coding standard
Installs: 1 379
Dependents: 0
Suggesters: 0
Security: 0
Stars: 630
Watchers: 34
Forks: 44
Type:application
pkg:composer/phpfmt/fmt
Requires
- php: >=7.0.0
- ext-tokenizer: *
Requires (Dev)
- ccirello/csp: 3.0.*
This package is not auto-updated.
Last update: 2016-06-01 02:11:30 UTC
README
This project follows a Code of Conduct.
Build statuses
Requirements
- PHP >= 7.0.0 to run the formatter. Note that the formatter can parse and format even a PHP file version 4 in case needed. HHVM is not supported.
Editor Plugins
Usage
$ php fmt.phar filename.php
$ php fmt.phar --help
Usage: fmt.phar [-hv] [-o=FILENAME] [--config=FILENAME] [--cache[=FILENAME]] [options] <target>
--cache[=FILENAME] cache file. Default: .php.tools.cache
--config=FILENAME configuration file. Default: .phpfmt.ini
--dry-run Runs the formatter without atually changing files;
returns exit code 1 if changes would have been applied
--ignore=PATTERN-1,PATTERN-N,... ignore file names whose names contain any PATTERN-N
--lint-before lint files before pretty printing (PHP must be declared in %PATH%/$PATH)
--no-backup no backup file (original.php~)
--profile=NAME use one of profiles present in configuration file
--version version
-h, --help this help message
-o=- output the formatted code to standard output
-o=file output the formatted code to "file"
-v verbose
If <target> is "-", it reads from stdin
What does the Code Formatter do?
K&R configuration
| Before | After |
|
|
|
|
|
note how it sorts the use clauses, and removes unused ones
|