webimpress/coding-standard
Opinionated PHP_CodeSniffer rules from Webimpress for consistent PHP style. Extends common standards, adds project conventions, and ships with ready-to-use configs for enforcing formatting and best practices across your codebase.
composer require --dev webimpress/coding-standard in any PHP project.phpcs.xml (or phpcs.dist.xml) file in your project root with:
<?xml version="1.0"?>
<ruleset name="CustomStandard">
<rule ref="Webimpress"/>
</ruleset>
vendor/bin/phpcs to scan your codebase. You’ll see violations matching the standard’s rules (e.g., PSR-12 deviations, internal naming conventions, strict type usage, etc.).vendor/bin/phpcbf to auto-fix many formatting issues (e.g., indentation, spacing, use statement order).Start by scanning a small module or legacy file to gauge impact—this standard is stricter than PSR-12 in areas like method visibility, property typing, and docblock syntax.
phpcs.xml in the root and include it via <configValue name="installed_paths" value="vendor/webimpress/coding-standard"/> to reference the standard without duplicating config.- name: Run PHPCS
run: vendor/bin/phpcs --standard=Webimpress
phpcs.xml, or install VS Code extensions that support custom standards.<rule ref="Webimpress">
<exclude name="Webimpress.Arrays.ArrayDeclaration.SpaceAfterComma"/>
<property name="tabIndent" value="true"/>
</rule>
webimpress/coding-standard as a dev dependency—no custom ruleset needed unless exceptions apply.declare(strict_types=1); Enforcement: The standard requires strict types in all files. Legacy files may fail until updated—use phpcbf or target exclusions carefully.webimpress/phpcs-compat Dependency: Ensure squizlabs/php_codesniffer is ≥3.7—older versions may not support newer sniffs.self type hints may trigger SelfUsage.Found errors. Use <exclude-pattern> in phpcs.xml for non-applicable files, or suppress selectively with // @codingStandardsIgnore.app/Sniffs/ and registering them via <rule ref="YourOwnStandard">, but prefer patching upstream if rules conflict meaningfully.phpcs -s to see which sniff caused a violation, or --report=checkstyle for CI-friendly output. Log verbose errors with --runtime-set testVersion 8.2.How can I help you explore Laravel packages today?