PHPackages                             fabianblum/phpcs-psr4-sniff - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. fabianblum/phpcs-psr4-sniff

ActivePhpcodesniffer-standard[PSR &amp; Standards](/categories/psr-standards)

fabianblum/phpcs-psr4-sniff
===========================

PHP\_CodeSniffer sniff that checks class name matches PSR-4 project structure. (PHP 8.3 ready)

3.0.1(1y ago)122.2k↓42.4%MITPHPPHP &gt;=7.1

Since Sep 3Pushed 1y agoCompare

[ Source](https://github.com/fabianblum/phpcs-psr4-sniff)[ Packagist](https://packagist.org/packages/fabianblum/phpcs-psr4-sniff)[ Docs](https://github.com/bitwise-operators/phpcs-psr4-sniff/)[ RSS](/packages/fabianblum-phpcs-psr4-sniff/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

bitwise-operators/phpcs-psr4-sniff
==================================

[](#bitwise-operatorsphpcs-psr4-sniff)

A custom [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) sniff to help to find classes that is not compliant with [PSR-4 Autoloader](https://www.php-fig.org/psr/psr-4/).

Public fork of abandoned package
================================

[](#public-fork-of-abandoned-package)

This package was originally hosted at , but seems to be abandoned. For ease of migration, the original namespacing has been kept.

To switch to this package, use the commands

```
composer remove suin/phpcs-psr4-sniff
composer require fabianblum/phpcs-psr4-sniff

```

Demo
----

[](#demo)

[![](tests/demo/demo.png)](tests/demo/demo.png)

Please visit [./tests/demo](/tests/demo), if you would like to try this sniff.

Features
--------

[](#features)

### Classes, interfaces and traits

[](#classes-interfaces-and-traits)

This sniff covers not only classes but also interfaces and traits.

### Namespaces and class names

[](#namespaces-and-class-names)

This sniff checks whether both of namespaces and class names match PSR-4 project structure.

### Configuration free

[](#configuration-free)

As this sniff respects `composer.json` [autoloading configuration](https://getcomposer.org/doc/04-schema.md#psr-4), you don't have to declare mapping between namespace prefixes and base directories.

Similar packages
----------------

[](#similar-packages)

### Psr4Fixer of PHP-CS-Fixer

[](#psr4fixer-of-php-cs-fixer)

[Psr4Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/src/Fixer/Basic/Psr4Fixer.php) checkes if class names should match the file name and fixes the class names if its don't correspond to the file names. It doesn't check the namespaces.

In contrast, this package checks not only class names but also namespaces.

### SlevomatCodingStandard.Files.TypeNameMatchesFileName

[](#slevomatcodingstandardfilestypenamematchesfilename)

[SlevomatCodingStandard.Files.TypeNameMatchesFileName](https://github.com/slevomat/coding-standard#slevomatcodingstandardfilestypenamematchesfilename) is a custom PHP Code Sniffer sniff to check whether namespaces and class names follow PSR-0/PSR-4 project structure.

This sniff is similar to suin/phpcs-psr4-sniff, but it needs explicit configuration about the PSR-0/PSR-4 project structure. suin/phpcs-psr4-sniff takes implicit way as it follows the autoloding configuration of Composer.

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

[](#installation)

```
composer require --dev suin/phpcs-psr4-sniff

```

Usage
-----

[](#usage)

At first, create a PHPCS ruleset XML (phpcs.xml.dist or phpcs.xml) file in the root of your project.

```

```

Then run it with the command:

```
vendor/bin/phpcs src

```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/bitwise-operators/phpcs-psr4-sniff/blob/master/CHANGELOG.md) for more details.

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

[](#contributing)

Send [issue](https://github.com/bitwise-operators/phpcs-psr4-sniff/issues) or [pull-request](https://github.com/bitwise-operators/phpcs-psr4-sniff/pulls) to main repository.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 64.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

Unknown

Total

1

Last Release

622d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4134bf5ad0494f5ecf2d4352c5c81c076e8aeb1ed9f9205cafc60e059ebc1e4e?d=identicon)[fabianblum](/maintainers/fabianblum)

---

Top Contributors

[![suin](https://avatars.githubusercontent.com/u/855338?v=4)](https://github.com/suin "suin (9 commits)")[![fabianblum](https://avatars.githubusercontent.com/u/16725150?v=4)](https://github.com/fabianblum "fabianblum (2 commits)")[![sveneld](https://avatars.githubusercontent.com/u/4028769?v=4)](https://github.com/sveneld "sveneld (2 commits)")[![bc-luke](https://avatars.githubusercontent.com/u/2160087?v=4)](https://github.com/bc-luke "bc-luke (1 commits)")

---

Tags

phpcsstatic analysisPHP\_CodeSniffernamespacePSR-4coding-standardscoding-style

### Embed Badge

![Health badge](/badges/fabianblum-phpcs-psr4-sniff/health.svg)

```
[![Health](https://phpackages.com/badges/fabianblum-phpcs-psr4-sniff/health.svg)](https://phpackages.com/packages/fabianblum-phpcs-psr4-sniff)
```

###  Alternatives

[suin/phpcs-psr4-sniff

PHP\_CodeSniffer sniff that checks class name matches PSR-4 project structure.

271.7M16](/packages/suin-phpcs-psr4-sniff)[automattic/vipwpcs

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

25510.2M145](/packages/automattic-vipwpcs)[yoast/yoastcs

PHP\_CodeSniffer rules for Yoast projects

221.1M29](/packages/yoast-yoastcs)[joomla/coding-standards

Joomla Coding Standards

129231.7k16](/packages/joomla-coding-standards)[mayflower/mo4-coding-standard

PHP CodeSniffer ruleset implementing the MO4 coding standards extending the Symfony coding standards.

17508.3k5](/packages/mayflower-mo4-coding-standard)[inpsyde/php-coding-standards

PHP 7.4+ coding standards for Syde WordPress projects.

101163.9k45](/packages/inpsyde-php-coding-standards)

PHPackages © 2026

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