LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

grumphp

PHP code quality enforcement via git hooks

TLDR

Generate a starter configuration file
$ grumphp configure
copy
Run all configured tasks
$ grumphp run
copy
Run specific tasks
$ grumphp run --tasks=[phpcs,phpunit]
copy
Run a specific testsuite
$ grumphp run --testsuite=[mytestsuite]
copy
Register GrumPHP's git hooks
$ grumphp git:init
copy
Unregister GrumPHP's git hooks
$ grumphp git:deinit
copy
Manually run the pre-commit hook tasks
$ grumphp git:pre-commit
copy

SYNOPSIS

grumphp command [options]

DESCRIPTION

GrumPHP is a PHP code quality tool that runs checks on git commits. It enforces coding standards by running tasks like PHPStan, PHP_CodeSniffer, and PHPUnit before allowing commits.The tool integrates with git hooks to prevent commits that fail quality checks. It is configurable via a grumphp.yml file in the project root.

PARAMETERS

COMMAND

Command to run.
configure
Generate a starter grumphp.yml configuration file, guessing sensible defaults.
run
Execute all configured tasks against the codebase.
git:init
Register GrumPHP's git hooks (run automatically after `composer install`).
git:deinit
Unregister GrumPHP's git hooks.
git:pre-commit
Run the tasks bound to the pre-commit hook.
git:commit-msg
Run the tasks that validate the commit message.
--tasks TASK1,TASK2
Only run the given comma-separated tasks.
--testsuite NAME
Only run tasks belonging to the given testsuite.
--help
Display help information.

CONFIGURATION

grumphp.yml

Project-level configuration file defining tasks, parameters, and git hook settings.

CAVEATS

PHP project specific. Requires Composer. May slow down commits with many tasks.

HISTORY

GrumPHP was created by phpro to automate PHP code quality enforcement through git hooks.

SEE ALSO

composer(1), phpcs(1), phpstan(1)

RESOURCES

Copied to clipboard
Kai