PHP conventions based on Grumphp tasks.

Fund package maintenance!

3.0.3 2021-04-06 13:51 UTC

This package is auto-updated.

Last update: 2021-04-06 13:55:32 UTC


Latest Stable Version GitHub stars Total Downloads License Say Thanks! Donate!

PHP conventions

This development tool provides a pre-defined configuration for GrumPHP with the following checks enabled:

The package provides a default configuration for each task, and it's customizable at will through a simple configuration file.

The package will install the required dependencies, so it works out of the box.

Tasks can be also added or skipped according to your need.


composer require drupol/php-conventions:^1.8 --dev

If you're not using GrumPHP

Manually add to your composer.json file

    "extra": {
        "grumphp": {
            "config-default-path": "vendor/drupol/php-conventions/config/php71/grumphp.yml"

Replace the string php71 with the minimal version of php you want to support.

Current choices are:

  • psr12
  • php71
  • php73

If you're using GrumPHP already

Edit the file grumphp.yml.dist or grumphp.yml and add on the top it:

  - { resource: vendor/drupol/php-conventions/config/php71/grumphp.yml }

To add an extra Grumphp task:

  - { resource: vendor/drupol/php-conventions/config/php71/grumphp.yml }

      threads: 1
      test_framework: phpspec
      configuration: infection.json.dist
      min_msi: 60
      min_covered_msi: 60
    - phpcs

In conjunction with extra_tasks, use skip_tasks to skip tasks if needed.


Do you want to specify some pre-defined tasks you want to run? It is easy to configure and run custom testsuites.

Available testsuites are:

  • cs (composer, composer_normalize, yamllint, phplint, twigcs, phpcsfixer, phpcs)
  • static-analysis (phpstan)
  • security (securitychecker)

To run a particular testsuite:

./vendor/bin/grumphp run --testsuite=cs


See the file CONTRIBUTING.md but feel free to contribute to this library by sending Github pull requests.