Collection of commonly used PHP QA tools.
Included in this package are:
- phpunit/phpunit The PHP Unit Testing framework.
- phpmd/phpmd PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD.
- squizlabs/php_codesniffer PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
- friendsofphp/php-cs-fixer A tool to automatically fix PHP Coding Standards issues.
- phpstan/phpstan A PHP Static Analysis Tool.
- vimeo/psalm A static analysis tool for PHP.
- phpmetrics/phpmetrics Static analysis tool for PHP.
Global install
composer global require bear/qatools
Local install
composer require --dev bear/qatools
cp vendor/bear/qatools/phpunit.xml.dist phpunit.xml
cp vendor/bear/qatools/phpcs.xml .
cp vendor/bear/qatools/phpmd.xml .
cp vendor/bear/qatools/phpstan.neon .
psalm --init
cp vendor/bear/qatools/.scrutinizer.yml .
composer tests # Run cs, sa, and test in sequence
composer test # Run PHPUnit tests
composer cs # Run PHP_CodeSniffer
composer cs-fix # Auto-fix coding standard violations with phpcbf
composer sa # Run all static analysis (phpstan, psalm, phpmd)
composer coverage # Generate test coverage report
composer metrics # Generate PHPMetrics HTML report
phpunit
phpunit
phpcs
phpcs --standard=./phpcs.xml src
phpstan
phpstan analyse -c phpstan.neon
psalm
psalm
phpmd
phpmd src text ./phpmd.xml
phpmetrics
phpmetrics --report-html=build/metrics src
- PSR-12 base with Doctrine Coding Standard
- PHPStan level: max
- Psalm errorLevel: 1
- PHP compatibility: 7.4+