A developer tool which provides a pre-defined GrumPHP configuration tailored specifically for PHP development.
The default GrumPHP configuration ships with the following checks:
- License file creation,
- Composer Require Checker,
composer.json
validation,- composer.json normalization,
- YAML Lint,
- JSON Lint,
- PHP Lint,
- Twig CS,
- PHP CS Fixer checks (Based on PSR12),
- PHP CS,
- PHPStan.
- PSalm,
It provides a default configuration for each task, and they are customizable at will through a simple YAML configuration file.
Tasks can be also added or skipped according to your need.
composer require drupol/php-conventions --dev
Manually add to your composer.json
file
"extra":
{
"grumphp":
{
"config-default-path": "vendor/drupol/php-conventions/config/php73/grumphp.yml",
},
}
Replace the string php73
with the minimal version of PHP you want to support.
Current choices are:
psr12
Edit the file grumphp.yml.dist
or grumphp.yml
and add on the top it:
imports:
- { resource: vendor/drupol/php-conventions/config/php73/grumphp.yml }
To add an extra GrumPHP task:
imports:
- { resource: vendor/drupol/php-conventions/config/php73/grumphp.yml }
parameters:
extra_tasks:
infection:
threads: 1
test_framework: phpspec
configuration: infection.json.dist
min_msi: 60
min_covered_msi: 60
skip_tasks:
- phpcsfixer
In conjunction with extra_tasks
, use skip_tasks
to skip tasks if needed.
vendor/bin/grumphp run
This will run all the pre-configured tasks.
If you're willing to specify a group of tasks only, you can use the pre-defined test suites.
Available test-suites are:
cs
- license
- composer_require_checker
- composer
- composer_normalize
- yamllint
- jsonlint
- phplint
- twigcs
- phpcsfixer
static-analysis
- phpstan
- psalm
To run a particular test-suite:
vendor/bin/grumphp run --testsuite=cs
To run particular tasks:
vendor/bin/grumphp run --tasks=phpcsfixer,phpstan
Report bug on the issue tracker.
See the file CONTRIBUTING.md but feel free to contribute to this library by sending Github pull requests.
See CHANGELOG.md for a changelog based on git commits.
For more detailed changelogs, please check the release changelogs.
To generate the changelog, use the following command:
docker-compose run auto_changelog --commit-limit false --hide-credit --sort-commits date-desc --breaking-pattern ""BREAKING CHANGE: yes" --template keepachangelog -u