Devsense PHP Code Analysis CLI
npm install phpyphpy package as a global command line tool:
.php files in current directory:_
.php files in current folder, skipt the tests folder:_
.php files in directory using "Laravel" coding style:_
Usage: phpy [options] [path...]
PHP Languge Server CLI
Arguments:
path Files or directories to be analyzed.
Options:
-V, --version output the version number
-r, --root Root directory, to which are other parameters relative. Current working directory by default.
-x, --exclude Files or directories to be excluded from indexing.
-c, --check Perform code analysis and output list of problems.
-f, --format [CodeStyle] Perform in-place code format. (choices: "Off", "PHPTools", "PSR2", "WordPress", "Allman", "KaR", "PSR12",
"Laravel", "Drupal", "Joomla", "PER", default: "PSR12")
--verbose Enable verbose output.
-h, --help display help for command
`
Background
The tool is a derivate from PHP Tools software. It provides the same code analysis as PHP Tools for Visual Studio Code and PHP Tools for Microsoft Visual Studio.
Benefits
- Does not require php executable, only npm.
- Fast processing even for large workspaces.
- Wide range of code analysis rules.
- Support for PHPStan, Psalm, PHPDoc Generics, Laravel Idea, and other annotations.
- Support for .phar` files.