PHP

http://phpqatools.org/

  1. PHPUnit is the de-facto standard unit test framework for PHP.
  2. phpmd scans PHP source code and looks for potential problems such as possible bugs, suboptimal code or overcomplicated expressions.
  3. phpcpd is a Copy/Paste Detector (CPD) for PHP code.
  4. phpdcd: code not used
  5. PHP_Depend is a PHP software metrics tool.
  6. PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.

molti software si possono installare globalmente con composer

composer global require phpunit/phpunit
composer global require phpmd/phpmd
composer global require phploc/phploc

PHP xdebug

@see php_ini

phploc

php beautyfier

PSR0/1/2 beautyfy

php-cs-fixer --level=psr1 fix common/Cache.php
sudo pear install channel://pear.php.net/PHP_Beautifier-0.1.15
php_beautifier script.php
 
# mostra gli standard installati
phpcs -i
# beautyfy directory
phpcs  --standard=Zend ./application
phpcs  --standard=PSR2 ./application

phpcpd

phpcpd ./admin

PHP CodeSniffer

disponibile in ubuntu

/usr/bin/phpcs

PHP MessDeterctor PHPMD

http://phpmd.org/documentation/index.html

usare i gruppi di regole di default

phpmd ./application/controllers text cleancode,codesize --minimumpriority=3

usare un file di regole custom:

phpmd /path/to/source text ./phpmd_rules.xml
    <?xml version="1.0"?>
    <ruleset name="custom PHPMD rule set"
             xmlns="http://pmd.sf.net/ruleset/1.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
                         http://pmd.sf.net/ruleset_xml_schema.xsd"
             xsi:noNamespaceSchemaLocation="
                         http://pmd.sf.net/ruleset_xml_schema.xsd">
        <description>
            custom rule set
        </description>
 
        <!-- Import the entire unused code rule set -->
        <rule ref="rulesets/unusedcode.xml" />
 
        <!-- Import the entire cyclomatic complexity rule -->
        <rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
 
    </ruleset>

PHP documentor

phpdoc -o HTML:frames:earthli -f fuel/packages/test/classes/lib/test.php -t docs

PHP Autoload Builder

phpab -o src/autoload.inc.php src
phpab -c -o src/autoload.inc.php src
phpab -o src/core/autoload.inc.php -b src src
phpab -p -o framework.phar framework/src
phpab -b . --tolerant -o zf1_autoload.php -e '*/Test/*' Zend