A reusable PHP_CodeSniffer ruleset plus the related static-analysis dependencies that RentPost uses across its PHP codebases.
This package provides a single phpcs.xml that combines hand-picked rules from
Slevomat, the standard PHP_CodeSniffer
sniffs (PSR/Generic/Squiz/PEAR/Zend), and a few RentPost-flavoured tweaks.
The goal is to surface coding-style problems so they can be fixed thoughtfully — not to auto-rewrite code. Tools like PHP-CS-Fixer are intentionally not part of this package; we prefer that developers learn the rules and fix violations themselves rather than rely on automated rewrites.
Add this package as a dev dependency:
composer require --dev rentpost/coding-standard-phpThen point your phpcs invocation at the bundled ruleset:
vendor/bin/phpcs --standard=vendor/rentpost/coding-standard-php/phpcs.xml src/Most editors/IDEs with a PHP_CodeSniffer plugin support pointing at a custom
phpcs.xml path — point them at vendor/rentpost/coding-standard-php/phpcs.xml.
A simple pre-commit hook template is bundled under .git-hooks/. It runs phpcs
and phpstan against staged files. The hook is disabled by default (it starts
with exit 0); remove that line and adjust the vendorPath variable to your
project's vendor directory if you want to use it.
To install the bundled hook into your repo's .git/hooks/, run:
vendor/bin/init-githooks ./vendorThe argument is the path to your composer vendor directory relative to the
repository root. The script copies hooks from this package into .git/hooks/
and substitutes the vendorPath placeholder in each.
The package also pulls in PHPStan as a dependency. This
repo does not ship a default phpstan.neon; configure your project's PHPStan
ruleset however suits your code base.
Future expansion may include: