skip to content

Search

1 min read

Easy way to install PHP QA tools

A bash snippet that installs phpunit, phploc, phpmd, pdepend and the rest of the PHP QA toolchain in one go through Composer.

If you need an easy and quick way to install your PHP QA tools, you can use the next bash snippet.

# Install composer based tools
cat > ~/.composer/composer.json <<EOF
{
    "require": {
        "halleck45/phpmetrics": "@dev",
        "squizlabs/php_codesniffer": "*",
        "phpunit/phpunit": "*",
        "sebastian/phpcpd": "*",
        "sebastian/phpdcd": "*",
        "phpmd/phpmd" : "@stable",
        "pdepend/pdepend" : "@stable",
        "phploc/phploc": "*",
        "sebastian/hhvm-wrapper": "*",
        "theseer/phpdox": "*"
    }
}
EOF
curl -sS https://getcomposer.org/installer | sudo php -- \
 --install-dir=/usr/local/bin --filename=composer
/usr/local/bin/composer global install
chown -R $SUDO_USER.$SUDO_USER ~/.composer

And all your required tools (phpunit, phploc, phpmd, pdepend, …) are now located at ~/.composer/vendor/bin, so set your $PATH environment variable to include it.

If you find it useful please share it.

All posts