PHP/ Composer

Library

Learnings

Baseline Composer

This is a boilerplate Composer for a global install, to provide common function for all projects. This includes testing, sniffing, etc.

{
    "require": {
        "asm89/twig-lint": "@stable",
        "squizlabs/php_codesniffer": "*",
        "friendsofphp/php-cs-fixer": "^2.9",
        "behat/behat": "^3.4",
        "behat/mink": "^1.7",
        "behat/mink-goutte-driver": "^1.2",
        "behat/mink-selenium2-driver": "^1.3",
        "behat/mink-extension": "^2.3",
        "consolidation/robo": "~1",
        "henrikbjorn/lurker": ">=1.3"
    },
    "require-dev": {
        "phpstan/phpstan": "^0.9.1",
        "leanphp/behat-code-coverage": "^3.4"
    },
    "repositories": [
        {
            "name": "henrikbjorn/lurker",
            "type": "vcs",
            "url": "https://github.com/lesichkovm/lurker"
        }
    ]
}
  • Twig-lint as Twig's my go-to template library
  • PHP Code Sniffer, PS CS Fixer and PHP Stan for PHP static analysis
  • Behat + Mink for BDD
  • Robo for automation (just starting with this one)
  • Lurker is the 'watcher' for Robo. Since the original henrikbjorn repo is abandoned and doesn't work with modern Symfony libraries, lesichkovm has forked it. But robo requires henrikbjorn's version, so the repositories object reorients it

@todo: Consider require-dev vs. require section. Since this is for a global dev environment, it honestly should all be in Require. Shouldn't it? Or would it be best practice to put all of that in require-dev to be a good copy-paste into any repos that's self-contained?