PHPackages                             danbettles/codesniffer-standard - 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. danbettles/codesniffer-standard

ActiveLibrary

danbettles/codesniffer-standard
===============================

A PHP\_CodeSniffer standard that mainly looks for abandoned debugging code

v3.0.0(4mo ago)1653↓52.8%16ISCPHPPHP ^8.3CI passing

Since Dec 31Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/danbettles/PHP_CodeSniffer_Standards_DanBettles)[ Packagist](https://packagist.org/packages/danbettles/codesniffer-standard)[ RSS](/packages/danbettles-codesniffer-standard/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (16)

PHP\_CodeSniffer Standard
=========================

[](#php_codesniffer-standard)

Important

This version of my PHP\_CodeSniffer Standard is for PHP\_CodeSniffer 4 and PHP 8.3+. Previous major versions target older incarnations of PHP\_CodeSniffer and PHP.

Tip

You may like to read about [how to unit-test a custom PHPCS Standard without having to 'install' it](#the-unit-tests)

The Sniffs
----------

[](#the-sniffs)

### Errors

[](#errors)

- PHP debugging functions (`print_r` and `var_dump`) are forbidden because I never use them for anything other than debugging.

### Warnings

[](#warnings)

- PHP output functions (`print` and `echo`) are considered suspect because I rarely—if ever—use them for anything other than debugging in object-oriented code, and since I tend to use short-echo tags (``) in output templates, I don't expect to see them elsewhere either.
- PHP script termination functions (`exit` and `die`) are considered suspect because they needn't be used in well-structured code; I use them only when debugging. I consider it bad-form to use these functions in a framework because they will likely prevent an application shutting-down cleanly, which, for one thing, can make it difficult to find out why output filters—or the like—are not being applied.
- JavaScript's `alert` function (`window.alert()`) is considered suspect because it's probably used more for debugging than anything else.
- Comments appearing to contain debugging code will be the subject of warnings. Debugging code should never be committed, even if it's commented. At the very least, commented debugging code is garbage, unwanted noise, and there's no sense in making your code more difficult to follow by leaving it lying around.
- One way or another, `TODO` and `FIXME` tags signal potential problems on the road ahead.

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

[](#installation)

Install using Composer, thus:

```
composer --dev require danbettles/codesniffer-standard
```

Usage
-----

[](#usage)

You can reference the Standard on the command-line with:

```
--standard=path/to/vendor/danbettles/codesniffer-standard/src/DanBettles
```

Alternatively, add the following Rule Element to your XML config file.

```

```

The Unit Tests
--------------

[](#the-unit-tests)

I had some difficulty upgrading the unit-tests for PHP\_CodeSniffer 3 and I still didn't like that you have to 'install' your custom Standard as part of the usual PHPCS approach. After some investigation, I tried [Payton Swick's solution](https://payton.codes/2017/12/15/creating-sniffs-for-a-phpcs-standard/#writing-tests), which worked out well—thank you, Payton.

Payton Swick's solution enables you to test your custom Standard in isolation, within the project. I developed his idea a little further, creating a sensibly opinionated test-case base-class that makes it straightforward to test your sniffs: straightforward if you follow usual PHPUnit conventions, and straightforward because it involves using PHPUnit in a more natural way.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance84

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 83.3% 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 ~2010 days

Total

3

Last Release

126d ago

Major Versions

v1.0.0 → v2.0.02020-02-12

v2.0.0 → v3.0.02026-01-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb4422c02b29b1ae4a4746abb1ebf16c0216d5fc62cf0604e7c6aa4de974b39b?d=identicon)[danbettles](/maintainers/danbettles)

---

Top Contributors

[![danbettles](https://avatars.githubusercontent.com/u/736672?v=4)](https://github.com/danbettles "danbettles (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

PHP\_CodeSnifferdebuggingcodesniffer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/danbettles-codesniffer-standard/health.svg)

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

###  Alternatives

[dealerdirect/phpcodesniffer-composer-installer

PHP\_CodeSniffer Standards Composer Installer Plugin

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

An elegant debug assistant for the Laravel framework.

5.2k67.8M190](/packages/laravel-telescope)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M93](/packages/itsgoingd-clockwork)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M81](/packages/rollbar-rollbar)[cakephp/cakephp-codesniffer

CakePHP CodeSniffer Standards

23711.0M654](/packages/cakephp-cakephp-codesniffer)[phpcsstandards/phpcsextra

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

10224.3M44](/packages/phpcsstandards-phpcsextra)

PHPackages © 2026

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