phpro / grumphp
A composer plugin that enables source code quality checks.
Installs: 10 966 557
Dependents: 1 083
Suggesters: 3
Security: 0
Stars: 4 145
Watchers: 79
Forks: 430
Open Issues: 21
Type:composer-plugin
Requires
- php: ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0
- composer-plugin-api: ^2.0
- ext-json: *
- amphp/amp: ^3.0
- amphp/parallel: ^2.1
- doctrine/collections: ^1.6.8 || ^2.0
- gitonomy/gitlib: ^1.3
- laravel/serializable-closure: ^1.1
- monolog/monolog: ^2.0 || ^3.0
- ondram/ci-detector: ^4.0
- psr/container: ^1.1 || ^2.0
- seld/jsonlint: ^1.8
- symfony/config: ^5.4 || ^6.0 || ^7.0
- symfony/console: ^5.4 || ^6.0 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.0 || ^7.0
- symfony/dotenv: ^5.4 || ^6.0 || ^7.0
- symfony/event-dispatcher: ^5.4 || ^6.0 || ^7.0
- symfony/expression-language: ^5.4 || ^6.0 || ^7.0
- symfony/filesystem: ^5.4 || ^6.0 || ^7.0
- symfony/finder: ^5.4 || ^6.0 || ^7.0
- symfony/options-resolver: ^5.4 || ^6.0 || ^7.0
- symfony/process: ^5.4 || ^6.0 || ^7.0
- symfony/yaml: ^5.4 || ^6.0 || ^7.0
Requires (Dev)
- brianium/paratest: ^6.4
- composer/composer: ^2.2.6
- nikic/php-parser: ^5.0
- php-parallel-lint/php-parallel-lint: ^1.3
- phpspec/phpspec: ^7.2
- phpspec/prophecy-phpunit: ^2.2
- phpunit/phpunit: ^9.5.13
Suggests
- atoum/atoum: Lets GrumPHP run your unit tests.
- behat/behat: Lets GrumPHP validate your project features.
- brianium/paratest: Lets GrumPHP run PHPUnit in parallel.
- codeception/codeception: Lets GrumPHP run your project's full stack tests
- consolidation/robo: Lets GrumPHP run your automated PHP tasks.
- designsecurity/progpilot: Lets GrumPHP be sure that there are no vulnerabilities in your code.
- doctrine/orm: Lets GrumPHP validate your Doctrine mapping files.
- enlightn/security-checker: Lets GrumPHP be sure that there are no known security issues.
- ergebnis/composer-normalize: Lets GrumPHP tidy and normalize your composer.json file.
- friendsofphp/php-cs-fixer: Lets GrumPHP automatically fix your codestyle.
- friendsoftwig/twigcs: Lets GrumPHP check Twig coding standard.
- infection/infection: Lets GrumPHP evaluate the quality your unit tests
- maglnet/composer-require-checker: Lets GrumPHP analyze composer dependencies.
- malukenho/kawaii-gherkin: Lets GrumPHP lint your Gherkin files.
- nette/tester: Lets GrumPHP run your unit tests with nette tester.
- nikic/php-parser: Lets GrumPHP run static analyses through your PHP files.
- pestphp/pest: Lets GrumPHP run your unit test with Pest PHP
- phan/phan: Lets GrumPHP unleash a static analyzer on your code
- phing/phing: Lets GrumPHP run your automated PHP tasks.
- php-parallel-lint/php-parallel-lint: Lets GrumPHP quickly lint your entire code base.
- phparkitect/phparkitect: Let GrumPHP keep your codebase coherent and solid, by permitting to add some architectural constraint check to your workflow.
- phpmd/phpmd: Lets GrumPHP sort out the mess in your code
- phpspec/phpspec: Lets GrumPHP spec your code.
- phpstan/phpstan: Lets GrumPHP discover bugs in your code without running it.
- phpunit/phpunit: Lets GrumPHP run your unit tests.
- povils/phpmnd: Lets GrumPHP help you detect magic numbers in PHP code.
- rector/rector : Lets GrumPHP instantly upgrade and automatically refactor your PHP code.
- roave/security-advisories: Lets GrumPHP be sure that there are no known security issues.
- sebastian/phpcpd: Lets GrumPHP find duplicated code.
- squizlabs/php_codesniffer: Lets GrumPHP sniff on your code.
- sstalle/php7cc: Lets GrumPHP check PHP 5.3 - 5.6 code compatibility with PHP 7.
- symfony/phpunit-bridge: Lets GrumPHP run your unit tests with the phpunit-bridge of Symfony.
- symplify/easy-coding-standard: Lets GrumPHP check coding standard.
- vimeo/psalm: Lets GrumPHP discover errors in your code without running it.
- vincentlanglet/twig-cs-fixer: Lets GrumPHP check and fix twig coding standard.
- v2.x-dev
- v2.9.0
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v2.0.0-beta1
- v1.x-dev
- v1.16.0
- v1.15.0
- v1.14.0
- v1.13.0
- v1.12.0
- v1.11.0
- v1.10.0
- v1.9.0
- v1.8.1
- v1.8.0
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.1
- v1.5.0
- v1.4.0
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.0
- v0.22.0
- v0.21.0
- v0.20.0
- v0.19.1
- v0.19.0
- v0.18.1
- v0.18.0
- v0.17.2
- v0.17.1
- v0.17.0
- v0.16.2
- v0.16.1
- v0.16.0
- v0.15.2
- v0.15.1
- v0.15.0
- v0.14.3
- v0.14.2
- v0.14.1
- v0.14.0
- v0.13.1
- v0.13.0
- v0.12.1
- v0.12.0
- v0.11.6
- v0.11.5
- v0.11.4
- v0.11.3
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.2
- v0.10.1
- v0.10.0
- v0.9.6
- v0.9.5
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.0
- v0.7.2
- v0.7.1
- v0.7.0
- v0.6.0
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.1
- v0.4.0
- v0.3.5
- v0.3.4
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.0
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-dependabot/composer/symfony/process-6.4.14
This package is auto-updated.
Last update: 2024-11-06 17:45:13 UTC
README
GrumPHP
Sick and tired of defending code quality over and over again? GrumPHP will do it for you! This composer plugin will register some git hooks in your package repository. When somebody commits changes, GrumPHP will run some tests on the committed code. If the tests fail, you won't be able to commit your changes. This handy tool will not only improve your codebase, it will also teach your co-workers to write better code following the best practices you've determined as a team.
GrumPHP has a set of common tasks built-in. You will be able to use GrumPHP with a minimum of configuration.
We don't want to bore you with all the details, so quick: install it yourself and unleash the power of GrumPHP!
Demo
Installation
In order for this package to work, you have to make sure following tools are discoverable on the command-line:
- php
- composer
- git
This package is a composer plugin and should be installed to your project's dev dependency using composer:
Install GrumPHP as a phar without dependencies:
composer require --dev phpro/grumphp-shim
Install GrumPHP with dependencies:
composer require --dev phpro/grumphp
Install GrumPHP without dependencies and automated git hooks through phive
phive install grumphp
When the package is installed, GrumPHP will attach itself to the git hooks of your project. You will see following message in the composer logs:
Watch out! GrumPHP is sniffing your commits!
GrumPHP will never push you into using a specific task. You can choose the tasks that fit your needs, and activate or
deactivate any task in no time! See the suggest
section in composer.json.
Note: GrumPHP will overwrite existing hooks unless you run composer install
with --no-plugins
or --no-scripts
.
We do create a backup of your git hook, but it's best to make sure you also have a backup of your custom hooks before you try to install GrumPHP.
Having trouble installing GrumPHP? Find out how to:
Configuration
Some things in GrumPHP can be configured in a grumphp.yml
or grumphp.yml.dist
or grumphp.dist.yml
file in the root of your project (the directory where you run the grumphp command).
You can specify a custom config filename and location in composer.json
or in the --config
option of the console commands.
# grumphp.yml grumphp: hooks_dir: ~ hooks_preset: local git_hook_variables: VAGRANT_HOST_DIR: . VAGRANT_PROJECT_DIR: /var/www EXEC_GRUMPHP_COMMAND: exec ENV: {} stop_on_failure: false ignore_unstaged_changes: false hide_circumvention_tip: false process_timeout: 60 ascii: failed: grumphp-grumpy.txt succeeded: grumphp-happy.txt parallel: enabled: true max_workers: 32 fixer: enabled: true fix_by_default: false environment: files: [] variables: {} paths: [] tasks: {} testsuites: [] extensions: []
Details of the configuration are broken down into the following sections.
- Parameters – Configuration settings for GrumPHP itself.
- Tasks – External tasks performing code validation and their respective configurations.
- TestSuites
- Extensions
- Extending the TaskRunner
- Conventions checker
Commands
Since GrumPHP is just a CLI tool, these commands can be triggered:
Compatibility
GrumPHP works with PHP 5.6 or above.
This package has been tested with following git clients:
- CLI Unix
- CLI Mac
- CLI Windows
- PhpStorm Git
- Atlassian SourceTree
- Syntevo SmartGit
Roadmap
Lots of tasks are already available to make sure your team writes great code. We are always looking to support new tasks. Feel free to log an issue or create a pull request for a task we forgot.
Are you missing a feature or did you find a bug? Log it in the issue tracker! Want to help out? Feel free to contact us!
FAQ
About
Submitting bugs and feature requests
Bugs and feature request are tracked on GitHub. Please take a look at our rules before contributing your code.
License
GrumPHP is licensed under the MIT License.