pint-rules is an extensible package of custom rules for Laravel Pint that helps you maintain consistent code style and high code quality in your PHP projects.
composer require --dev pekral/pint-rulesDuring install (or update), a pint.json file is created in your project root if it does not already exist. To overwrite an existing pint.json with the package default, run:
vendor/bin/pint-rules install --force- Use the
pint.jsonin your project root (created by the installer), or point Pint to the package config. - Run Pint with this configuration:
./vendor/bin/pint --config=vendor/pekral/pint-rules/pint.json./vendor/bin/pint --config=vendor/pekral/pint-rules/pint.json src/./vendor/bin/pint --config=vendor/pekral/pint-rules/pint.json --fix src/{
"preset": "vendor/pekral/pint-rules/pint.json",
"rules": {
// Your custom rules here
}
}Rules can be customized in your pint.json; see the Laravel Pint documentation for available rules and configuration.
- Rules can be extended and customized in
pint.json. - Supports PHP 8.4+.
- Easy integration with CI/CD (GitHub Actions, GitLab CI, ...).
The project uses the same GitHub Actions and Composer scripts as pekral/php-skeleton:
.github/workflows/checkers.yml— PHPCS, Pint, Rector, PHPStan, tests with coverage, security audit, composer validate/normalize, XML lint (on push/PR tomaster/mainand weekly)..github/workflows/stale.yml— Marks and closes stale issues/PRs (daily + manual)..github/dependabot.yml— Weekly updates for Composer and GitHub Actions.
Local commands (same as CI):
composer check # Full quality pipeline (normalize, phpcs, pint, rector, phpstan, audit, tests)
composer fix # Apply all automatic fixes (normalize, rector, pint, phpcs)Q: How do I add a custom rule?
A: Add it to your pint.json or extend this package.
Q: How do I run Pint only on specific folders?
A: Adjust the path in the Pint command, e.g. src/, app/.
Q: How can I contribute? A: Open an issue or pull request on GitHub.
This package is licensed under the MIT license.