- Notifications
You must be signed in to change notification settings - Fork440
phpro/grumphp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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!
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 ordeactivate any task in no time! See thesuggest
section incomposer.json.
Note: GrumPHP will overwrite existing hooks unless you runcomposer 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:
Some things in GrumPHP can be configured in agrumphp.yml
orgrumphp.yml.dist
orgrumphp.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 incomposer.json
or in the--config
option of the console commands.
# grumphp.ymlgrumphp:hooks_dir:~hooks_preset:localgit_hook_variables:VAGRANT_HOST_DIR:.VAGRANT_PROJECT_DIR:/var/wwwEXEC_GRUMPHP_COMMAND:execENV:{}stop_on_failure:falseignore_unstaged_changes:falsehide_circumvention_tip:falseprocess_timeout:60ascii:failed:grumphp-grumpy.txtsucceeded:grumphp-happy.txtparallel:enabled:truemax_workers:32fixer:enabled:truefix_by_default:falseenvironment: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
Since GrumPHP is just a CLI tool, these commands can be triggered:
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
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 theissue tracker!Want to help out? Feel free to contact us!
Bugs and feature request are tracked onGitHub.Please take a look at our rules beforecontributing your code.
GrumPHP is licensed under theMIT License.
About
A PHP code-quality tool