- What is phpro/grumphp-shim and why should I use it in a Laravel project?
- It is a PHAR distribution shim for GrumPHP that lets you run GrumPHP code-quality checks without installing all of GrumPHP's dependencies into your project. In Laravel, this avoids polluting composer.json and reduces conflicts with tools like Pint, Pest, and PHPUnit. You install it as a dev dependency and execute vendor/bin/grumphp.phar run. Use it when you want local quality gates but not a full GrumPHP dependency tree.
- How do I install phpro/grumphp-shim in a Laravel app?
- Install it with Composer as a development dependency: composer require --dev phpro/grumphp-shim. Then call the shim executable using vendor/bin/grumphp.phar run. No global installation is required. Commit your Composer lock file and .grumphp.yml so teammates and CI use the same setup.
- How do I run GrumPHP checks with the shim?
- Run vendor/bin/grumphp.phar run from your Laravel project root. The shim behaves like the original GrumPHP executable and reads your .grumphp.yml configuration. You can add the command to Composer scripts or Git hooks. Use verbose output or redirection if you need detailed logs for troubleshooting.
- Does phpro/grumphp-shim work with Laravel Pint, Pest, and PHPUnit?
- Yes, the shim is designed to run GrumPHP tasks, and GrumPHP can invoke Laravel-native tools such as Laravel Pint, Pest, and PHPUnit through its task configuration. You define those tasks in .grumphp.yml. Because the shim isolates GrumPHP's own dependencies, it helps avoid version conflicts with your Laravel app's test and formatting tools. Pin task versions where needed and test the setup locally before relying on it in CI.
- Which Laravel and PHP versions are supported by phpro/grumphp-shim?
- The shim is a GrumPHP PHAR distribution and is not tied to a specific Laravel version in the way a Laravel package might be. Your Laravel project must meet the PHP and extension requirements of the GrumPHP PHAR and any tasks you configure. Check the package's Composer requirements and the main GrumPHP release notes for exact PHP constraints. Test against your target Laravel, PHP, and extension matrix before rolling it out.
- How should I configure .grumphp.yml for a Laravel project?
- Create a .grumphp.yml file at the project root and define the tasks you want, such as Pint, PHPUnit or Pest, PHPStan, or custom scripts. Keep the configuration version-controlled so every developer and CI job uses the same rules. Start with a small set of fast checks for pre-commit and move slower checks to CI. Avoid duplicating checks already enforced by other Composer scripts.
- Can I use phpro/grumphp-shim for Git pre-commit hooks in Laravel?
- Yes, you can reference vendor/bin/grumphp.phar run from a pre-commit hook or a Composer script that your hook calls. This lets GrumPHP enforce standards before commits without installing GrumPHP's full dependency set. Audit any existing hooks first so you do not run duplicate linting or testing. For performance, keep slow tasks out of pre-commit and run them in CI.
- How does the PHAR shim avoid Composer dependency conflicts?
- The shim ships GrumPHP as a PHAR, so GrumPHP's internal dependencies are bundled rather than resolved into your Laravel project's composer.json. That reduces the chance of conflicts with Laravel's PHPUnit, Pest, PHPStan, or other dev dependencies. Your project still needs the tools that GrumPHP tasks invoke, such as PHPUnit or Pint, if you configure those tasks. Pin versions in .grumphp.yml and test upgrades in a branch.
- Can I use phpro/grumphp-shim in CI/CD pipelines?
- Yes, CI pipelines can call vendor/bin/grumphp.phar run after Composer install. The PHAR-based execution keeps the CI step lightweight and avoids adding GrumPHP's dependencies to the project. Enable GrumPHP caching where supported to speed up repeated runs. Ensure your CI PHP image has the extensions required by the configured tasks, such as those needed by PHPUnit.
- What are alternatives to phpro/grumphp-shim and how is it maintained?
- Alternatives include installing GrumPHP directly with Composer, using standalone tools like Pint, PHPStan, and PHPUnit in Composer scripts, or relying on CI-only checks. The shim tracks GrumPHP releases and points users to the main phpro/grumphp repository for options and release notes. Check the shim's repository and Composer metadata for current maintenance status before adopting it. Choose it when PHAR isolation matters more than having GrumPHP as a normal Composer dependency.