Sofware Development Archive

Easy way to install PHP QA tools

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": "*"
curl -sS | 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.

Simplified version of my PHP test runner

In my course of getting continuous testing in practice I have improved my test runner by using less dependencies.

Previously I have implemented this by using Ruby and its Watchr gem, but now this script only relies on inotifywait binary available in major distributions.

As usual this script helps you to track your code for changes and if changed it will automatically run a bunch of actions.

We all tend to assume that other people think like us. But they don’t. Psychologists call this the false consensus bias

Giles Colborne in “97 things every programmer should know”

Features that offer value to a minority of users impose a cost on all users.

Douglas Cockford in Javascript: The Good Parts

Steps toward modernizing a legacy codebase

Paul M Jones presented at the Nashville PHP User Group on August 13th, 2012 on modernizing legacy code.

“We’ve all been there, dropped into a codebase that makes perfect sense to the original developers but might as well be Greek to you. Paul will help you make sense of things with some helpful tips for untangling the spaghetti and how to move it towards a more modern, modular architecture while keeping it running the whole time.”

Page 1 of 3