PHPackages                             tienne/php\_codesniffer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. tienne/php\_codesniffer

ActiveLibrary[Testing &amp; Quality](/categories/testing)

tienne/php\_codesniffer
=======================

PHP\_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.

2.0(9y ago)019BSD-3-ClausePHPPHP &gt;=5.1.2

Since Apr 20Pushed 9y agoCompare

[ Source](https://github.com/tienne/PHP_CodeSniffer)[ Packagist](https://packagist.org/packages/tienne/php_codesniffer)[ Docs](https://github.com/tienne/PHP_CodeSniffer)[ RSS](/packages/tienne-php-codesniffer/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

About
-----

[](#about)

PHP\_CodeSniffer is a set of two PHP scripts; the main `phpcs` script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second `phpcbf` script to automatically correct coding standard violations. PHP\_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.

[![Build Status](https://camo.githubusercontent.com/0311abea186c2d0a9ed18b4d855cb1f08e2586a7676ec170eb69938097ce9567/68747470733a2f2f7472617669732d63692e6f72672f737175697a6c6162732f5048505f436f6465536e69666665722e7376673f6272616e63683d70687063732d6669786572)](https://travis-ci.org/squizlabs/PHP_CodeSniffer) [![Code consistency](https://camo.githubusercontent.com/c753ca80744879d6e7c9519f676b875f57ebce0186b2fd94fe25ff2fb94ec2ee/687474703a2f2f737175697a6c6162732e6769746875622e696f2f5048505f436f6465536e69666665722f616e616c797369732f737175697a6c6162732f5048505f436f6465536e69666665722f67726164652e737667)](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer)

[![Join the chat at https://gitter.im/squizlabs/PHP_CodeSniffer](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/squizlabs/PHP_CodeSniffer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Requirements
------------

[](#requirements)

PHP\_CodeSniffer requires PHP version 5.1.2 or greater, although individual sniffs may have additional requirements such as external applications and scripts. See the [Configuration Options manual page](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options) for a list of these requirements.

The SVN pre-commit hook requires PHP version 5.2.4 or greater due to its use of the vertical whitespace character.

Installation
------------

[](#installation)

The easiest way to get started with PHP\_CodeSniffer is to download the [Phar](http://php.net/manual/en/intro.phar.php) files for each of the commands:

```
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
php phpcs.phar -h

curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
php phpcbf.phar -h

```

If you use PEAR, you can install PHP\_CodeSniffer using the PEAR installer. This will make the `phpcs` and `phpcbf` commands immediately available for use. To install PHP\_CodeSniffer using the PEAR installer, first ensure you have [installed PEAR](http://pear.php.net/manual/en/installation.getting.php) and then run the following command:

```
pear install PHP_CodeSniffer

```

If you prefer using [Composer](http://getcomposer.org/) you can easily install PHP\_CodeSniffer system-wide with the following command:

```
composer global require "squizlabs/php_codesniffer=*"

```

Make sure you have the composer bin dir in your PATH. The default value is `~/.composer/vendor/bin/`, but you can check the value that you need to use by running `composer global config bin-dir --absolute`.

Or alternatively, include a dependency for `squizlabs/php_codesniffer` in your `composer.json` file. For example:

```
{
    "require-dev": {
        "squizlabs/php_codesniffer": "2.*"
    }
}
```

You will then be able to run PHP\_CodeSniffer from the vendor bin directory:

```
./vendor/bin/phpcs -h
./vendor/bin/phpcbf -h

```

You can also download the PHP\_CodeSniffer source and run the `phpcs` and `phpcbf` commands directly from the Git clone:

```
git clone https://github.com/squizlabs/PHP_CodeSniffer.git
cd PHP_CodeSniffer
php scripts/phpcs -h
php scripts/phpcbf -h

```

Documentation
-------------

[](#documentation)

The documentation for PHP\_CodeSniffer is available on the [Github wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki).

Information about upcoming features and releases is available on the [Squiz Labs blog](http://www.squizlabs.com/php-codesniffer).

Issues
------

[](#issues)

Bug reports and feature requests can be submitted on the [Github Issue Tracker](https://github.com/squizlabs/PHP_CodeSniffer/issues) or the [PEAR bug tracker](http://pear.php.net/package/PHP_CodeSniffer/bugs).

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3314d ago

Major Versions

1.0 → 2.02017-04-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c279aa3dcb28b75f55e6c6269a61fd9b5de19118204441211502f404852bb2c?d=identicon)[tienne](/maintainers/tienne)

---

Top Contributors

[![davidKwon89](https://avatars.githubusercontent.com/u/24446895?v=4)](https://github.com/davidKwon89 "davidKwon89 (2 commits)")

---

Tags

standardsphpcs

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tienne-php-codesniffer/health.svg)

```
[![Health](https://phpackages.com/badges/tienne-php-codesniffer/health.svg)](https://phpackages.com/packages/tienne-php-codesniffer)
```

###  Alternatives

[wp-coding-standards/wpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress coding conventions

2.7k42.5M1.6k](/packages/wp-coding-standards-wpcs)[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

596161.9M1.9k](/packages/dealerdirect-phpcodesniffer-composer-installer)[phpcompatibility/phpcompatibility-wp

A ruleset for PHP\_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.

21830.6M587](/packages/phpcompatibility-phpcompatibility-wp)[phpcsstandards/phpcsextra

A collection of sniffs and standards for use with PHP\_CodeSniffer.

10224.3M44](/packages/phpcsstandards-phpcsextra)[acquia/coding-standards

PHP\_CodeSniffer rules (sniffs) for Acquia coding standards

214.8M28](/packages/acquia-coding-standards)[moxio/php-codesniffer-sniffs

Custom sniffs for PHP\_CodeSniffer

18283.0k3](/packages/moxio-php-codesniffer-sniffs)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
