Skip to content

mario-naether/php-ci-template

Repository files navigation

php-ci-template

Latest Stable Version Latest Unstable Version License Build Status PHP runtimes PHP runtimes

This package provide some PHP quality assurance Tools inspired by http://jenkins-php.org/

##UnitTest with Codeception ####Modules

###Factory Muffin Faker

###Faker

###Automatic PhantomJS install For using the PhantomJS installer, add this code to your composer.json

"scripts-dev": {
    "post-install-cmd": [
        "PhantomInstaller\\Installer::installPhantomJS"
    ],
    "post-update-cmd": [
        "PhantomInstaller\\Installer::installPhantomJS"
    ]
}

##Quality assurance Tools ###Analyze PHP code with one command

edgedesign/phpqa

  • phploc
  • phpcpd
  • phpcs
  • pdepend
  • phpmd
  • phpmetrics
vendor/bin/phpqa --analyzedDirs ./examples/src/ --buildDir ./build/logs --report

For a working Copy/Paste Detection in PHP QA Tool using this:

PHP 5.4/5.5

composer require sebastian/phpcpd:dev-master#de90566 --ignore-platform-reqs php

###Analyze PHP Code in seperate commands

mkdir build/logs

####pdepend (https://pdepend.org/)

vendor/bin/pdepend --jdepend-xml=./build/logs/pdepend-jdepend.xml --summary-xml=./build/logs/pdepend-summary.xml --dependency-xml=./build/logs/pdepend-dependencies.xml --jdepend-chart=./build/logs/pdepend-jdepend.svg --overview-pyramid=./build/logs/pdepend-pyramid.svg ./examples/src/

####phpcpd (https://github.com/sebastianbergmann/phpcpd)

vendor/bin/phpcpd --log-pmd build/logs/pmd-cpd.xml ./examples/src

####phploc (https://github.com/sebastianbergmann/phploc)

vendor/bin/phploc --progress  --exclude=vendor ./examples/src/ --log-xml ./build/logs/phploc.xml

####phpmd (https://phpmd.org/)

vendor/bin/phpmd examples/src xml ./vendor/edgedesign/phpqa/app/phpmd.xml --suffixes php  --exclude /vendor/ --reportfile ./build/logs/phpmd.xml

####phpcs (https://github.com/squizlabs/PHP_CodeSniffer)

vendor/bin/phpcs -p --extensions=php --standard=PSR2  --ignore=*/vendor/* ./examples/src/ --report=checkstyle --report-file=./build/logs/checkstyle.xml

####phpmetrics (https://github.com/phpmetrics/PhpMetrics)

vendor/bin/phpmetrics ./examples/src/ --extensions php  --excluded-dirs="vendor" --offline --report-html ./build/logs/phpmetrics.html --report-xml ./build/logs/phpmetrics.xml

####php-cs-fixer (https://github.com/FriendsOfPHP/PHP-CS-Fixer)

vendor/bin/php-cs-fixer fix

####ApiGen (https://github.com/ApiGen/ApiGen)

vendor/bin/apigen generate