drupol/php-conventions

PHP conventions based on Grumphp tasks.

Fund package maintenance!
drupol

1.7.1 2020-05-11 04:52 UTC

This package is auto-updated.

Last update: 2020-05-11 04:53:41 UTC


README

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.

The following versions of PHP are supported:

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

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 php71 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:
    infection:
      threads: 10
      test_framework: phpspec
      configuration: infection.json.dist
      min_msi: 60
      min_covered_msi: 60
      metadata:
        priority: 2000
  skip_tasks:
    - phpcs

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.