drupol/php-conventions

PHP conventions for coding libraries based on Grumphp.

1.6.1 2019-09-17 19:33 UTC

README

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

PHP conventions

This tool will check your code style against a set of defined tasks and rules.

It's based on GrumPHP and comes with a default configuration, customizable at will.

The following tasks are enabled:

You can also add or skip tasks if needed.

The following versions of PHP are supported:

  • PHP 5.6
  • PHP 7
  • PHP 7.1
  • PHP 7.3

Installation

composer require drupol/php-conventions --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 php7 with the minimal version of php you want to support.

Current choices are:

  • psr12
  • php56
  • php7
  • php71
  • php73

If you're using GrumPHP already

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

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

To add an extra Grumphp task:

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

parameters:
  extra_tasks:
    phpstan:
      always_execute: false
  skip_tasks:
    - composer

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

Contributing

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