Run style checks on PHP files before committing to catch formatting violations like wrong indentation or naming conventions.
Automatically fix common coding standard violations in a PHP codebase using the companion phpcbf command.
Add automated style enforcement to a CI pipeline so every pull request is checked against PSR-12 or a custom standard before merging.
This repository is abandoned, use PHPCSStandards/PHP_CodeSniffer for active development and security fixes.
PHP_CodeSniffer is a command-line tool for checking PHP, JavaScript, and CSS files against a defined set of coding style rules. It tells you when your code breaks those rules, and a companion tool called phpcbf can automatically fix many of the violations it finds. The goal is to keep a codebase consistent when multiple people are working on it, or when a project has agreed to follow a particular formatting standard. Note that this specific repository has been officially abandoned by its original maintainers. Active development moved to a successor repository at PHPCSStandards/PHP_CodeSniffer, which is where new releases, bug fixes, and contributions now go. The tool works by reading your source files and applying a set of rules called a coding standard. It ships with several built-in standards, including PEAR and PSR-12, which are widely used naming and formatting conventions in the PHP world. You can also write your own custom rules. You run it from the command line pointing it at a file or directory, and it produces a report showing which lines have violations and what the problem is. Installation can be done through Composer (the standard PHP package manager), via Phive, via the older PEAR installer, or by downloading standalone executable files called Phars that do not need any package manager. The tool requires PHP version 5.4 or higher. It is most useful as part of an automated quality check, such as running it on every code commit in a continuous integration pipeline to catch style problems before they are merged. The README notes that some individual rules may have additional requirements beyond PHP itself. The project uses a standard MAJOR.MINOR.PATCH version numbering scheme.
← squizlabs on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.