• Stars
    star
    4,129
  • Rank 10,487 (Top 0.3 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 9 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A PHP code-quality tool

Github Actions AppVeyor Installs Packagist

Twitter Join the chat at https://gitter.im/phpro/grumphp

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

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.

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.

More Repositories

1

soap-client

A general purpose SOAP client for PHP
PHP
854
star
2

api-problem

RFC7807 Problem details implementation
PHP
65
star
3

http-tools

HTTP tools for developing more consistent HTTP implementations.
PHP
28
star
4

api-problem-bundle

RFC7807 Problem details integration for Symfony
PHP
22
star
5

grumphp-shim

This repository provides easy way to install GrumPHP without the risk of conflicting dependencies.
PHP
22
star
6

zf-doctrine-hydration-module

Configurable Doctrine hydrators for ZF2
PHP
18
star
7

phpro-mage2-module-cookie-consent

With this module your store can become GDPR compliant in no time. As a store-owner, you can now divide cookies into categories and have a quick overview of what cookies are being used by your store. Your customers can select their cookie preferences from within a customizable popup.
PHP
18
star
8

annotated-cache

Makes it easy to configure the caching of your services with annotations.
PHP
17
star
9

mage-remote-media

Magento development tool to automatically fetch catalog product images from a production environment for a development or staging environment
PHP
16
star
10

phpro-mage2-module-translations

Translation module for Magento 2
PHP
12
star
11

phpro-mage2-module-scheduler

Easily view and manage cron jobs in Magento 2
PHP
9
star
12

zf-mail-manager

An easy-to-use mailmanager for ZF2 that lets you focus on creating your mails.
PHP
8
star
13

soap-client-sf2-bridge

A Symfony2 bridge for the phpro/soap-client package
PHP
7
star
14

symfony-conventions

GrumPHP conventions for Symfony projects at PHPro
PHP
6
star
15

zf-smartcrud

PHP
4
star
16

zf-apigility-doctrine-bulk

A module that provides an extendable and fast way of adding bulk actions to the doctrine apigility module.
PHP
4
star
17

zf-mvc-auth-token

PHP
3
star
18

zf-filesystem

PHP
3
star
19

annotated-cache-bundle

Provides a Symfony bridge for the phpro/annotated-cache library
PHP
3
star
20

phpro-mage2-module-sales-state-events

PHP
2
star
21

zf-charts

A chart abstraction layer for ZF2.
PHP
2
star
22

phpro-mage2-module-api-logger

PHP
1
star
23

zf-encoding-com

Wrapper for the encoding.com API
PHP
1
star
24

phpro-mage2-module-logger-handler

PHP
1
star
25

security-workshop

CSS
1
star
26

phpro-mage2-module-bypass-page-cache

Module to bypass to fullpage cache
PHP
1
star