Public | Automated Build

Last pushed: a year ago
Short Description
Docker image for running PHP QA Tools
Full Description


Docker image for running PHP QA Tools


docker run --rm -u $UID -v $PWD:/app eko3alpha/docker-phpqa --report --ignoredDirs vendor,build,migrations,test


You can also create an alias so you dont have to type that whole command! More information can be found here: Dockerize Commands


sudo pico ~/.bash_profile


sudo pico ~/.bash_aliases

Then add the following entry, in this case we're calling it "phpqa" you can change it to whatever you want. Make sure to wrap it in single quotes.

alias phpqa='docker run --rm -u "$UID" -v "$PWD:/app" eko3alpha/docker-phpqa'

After you add the entry refresh the profile

source ~/.bash_profile

Now you can use phpqa tools anywhere! Make sure you are in the root directory of your project and then run

phpqa --report

For full documentation please head over to PHP QA Docs


Command Description
phpqa --help Show help - available options, tools, default values, ...
phpqa --analyzedDir ./ --buildDir ./build Analyze current directory and save output to build directory
phpqa --ignoredDirs build,vendor Ignore directories
phpqa --ignoredFiles RoboFile.php Ignore files
phpqa --tools phploc,phpcs Run only selected tools
phpqa --tools phpmd:1,phpcs:0,phpcpd:0 Check number of errors and exit code. New in v1.6
phpqa --verbose Show output from executed tools
phpqa --quiet Show no output at all
phpqa --output cli CLI output instead of creating files in --buildDir
phpqa --execution no-parallel Don't use parallelism if --execution != parallel
phpqa --config ./my-config Use custom configuration
phpqa --report Build html reports
phpqa tools Show versions of available tools

Output modes

Tool --output file (default) - generated files --output cli
phploc phploc.xml
phpcpd phpcpd.xml
phpcs checkstyle.xml full report
pdepend pdepend-jdepend.xml, pdepend-summary.xml, pdepend-jdepend.svg, pdepend-pyramid.svg
phpmd phpmd.xml
phpmetrics phpmetrics.html, phpmetrics.xml

PHP Mess Detector

If you want to change the rules for PHPMD first go here and generate your own rules. Below is a sample output

<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="pcsg-generated-ruleset" 
<description>Created with the PHP Coding Standard Generator.
<rule ref="rulesets/controversial.xml/Superglobals"/>
<rule ref="rulesets/design.xml/ExitExpression"/>
<rule ref="rulesets/design.xml/EvalExpression"/>
<rule ref="rulesets/design.xml/GotoStatement"/>
<rule ref="rulesets/naming.xml"/>
<rule ref="rulesets/unusedcode.xml"/>

Once you create your own rule set, copy and paste the XML into a file. In this example we're naming the file


PHPQA will search for a YML file named .phpqa.yml in the directory you to run this docker file from. In this YML file there is a section for phpmd

    standard: phpmd.rules.xml

Make sure the location of the xml file (phpmd.rules.xml) is relative to .phpqa.yml. Save and run the docker file.

docker run --rm -u $UID -v $PWD:/app eko3alpha/docker-phpqa --report --tools phpmd --verbose

or if you created an alias

phpqa --report --tools phpmd --verbose
Docker Pull Command
Source Repository