PHP 8.3+
Low commit activity in last 18 months
A long-lived project that still receives updates
grumphp config to automatically check conventions for Laravel projects
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

phpro/grumphp
^2.0
phpmd/phpmd
^2.9
squizlabs/php_codesniffer
^3.5
fakerphp/faker
^1.9
spatie/test-time
^1.2
mockery/mockery
^1.4.2
php-parallel-lint/php-parallel-lint
^1.3
jrmadsen67/laravel-route-coverage-test
^1.1
monolog/monolog
^3.0
symfony/console
^7.4|^8.0
yieldstudio/grumphp-laravel-pint
^1.0
pestphp/pest-plugin-livewire
^4.1|dev-main
pestphp/pest-plugin-faker
^4.0
pestphp/pest-plugin-browser
^4.0
 Project Readme

Goal

Configuration for grumphp that is checking on each commit that the committed code passes the unit tests, complies with the PSR2 coding style and static analysis check. It runs the following checks:

  • Check that composer.json is valid
  • Check that composer does not have any dependencies for known security vulnerabilities with SensioLabs Security Checker
  • Check that commit does not contain any debugging (var_dump, die, exit)
  • Check that code complies with the PSR2 coding style
  • Perform static code analysis using phpstan
  • Check code for unnecessary complexity etc. with PHP Mess Detector
  • Check that unit tests pass with PHPUnit

Installation

1. Add checker to your composer.json:

composer require --dev diviky/code-analysis

2. Add path to grumphp configuration file to your composer.json's extra:

    "extra": {
        "grumphp": {
            "config-default-path": "vendor/diviky/code-analysis/grumphp.yml"
        }
    }

Test suites

If you want to run the coding style or static analysis checks only, you can run the following commands:

php artisan self-diagnosis

composer validate

vendor/bin/grumphp run --testsuite=style
vendor/bin/grumphp run --testsuite=static
vendor/bin/php-cs-fixer fix --allow-risky=yes
vendor/bin/psalm
vendor/bin/phpstan analyse src
vendor/bin/testbench package:test --parallel
vendor/bin/phpunit --coverage-html coverage

License

The MIT License (MIT). Please see License File for more information.