Collection of PHP QA tools
PHP
Clone or download

README.md

bear/qatools

Collection of commonly used php QA tools.

Included in this package are:

Installation

Global install

composer global require bear/qatools

Local install

composer require bear/qatools

Config

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/.php_cs.dist .php_cs

for CI web service

cp vendor/bear/qatools/.travis.yml .
cp vendor/bear/qatools/.scrutinizer.yml .

When using file header, You need to edit the header section in.php_cs.

$header = <<<'EOF'
This file is part of the __PACKAGE__ package.

@license http://opensource.org/licenses/MIT MIT
EOF;

Place edit the header text then uncomment header_comment section.

//        'header_comment' => ['header' => $header, 'commentType' => 'comment', 'separate' => 'none'],

Although I tried to set config as based on what is used in the standard, Please change on demand.

Usage

All

phpcs, phpmd, phpunit, php-cs-fixer, pdepend, phploc, apigen and php-cs-fixer will be executed in order. This is the ideal for CI.

global

~/.composer/vendor/bin/phpbuild

local

vendor/bin/phpbuild

Since php-cs-fixer only issues a warning, please modify the code with php-cs-fixer fix src command if necessary.

Individual execution

development

phpunit

vendor/bin/phpunit

phpunit + phpmd + phpcs + php-cs-fixer + phpstan + psalm

vendor/bin/phptest

per commit

php-cs-fixer

vendor/bin/php-cs-fixer fix src

phpcs

vendor/bin/phpcs --standard=./phpcs.xml src
vendor/bin/phpcs --standard=./phpcs.xml --warning-severity=false src
vendor/bin/phpcs --standard=vendor/bear/qatools/phpcs.xml --warning-severity=false src

per deploy

security-checker

vendor/bin/security-checker security:check

code quality

phpstan

vendor/bin/phpstan analyse -l max src

psalm

vendor/bin/psalm

phploc

vendor/bin/phploc src

phpcpd

vendor/bin/phpcpd src

documentation

apigen

vendor/bin/apigen.phar generate -s src -d build/api

phpcb

vendor/bin/phpcb -s src -o build/code-browser