PHPackages                             spryker/architecture-sniffer - 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. [Framework](/categories/framework)
4. /
5. spryker/architecture-sniffer

ActiveLibrary[Framework](/categories/framework)

spryker/architecture-sniffer
============================

Spryker Architecture Sniffer

0.6.0(2w ago)142.8M↓21.9%2[10 issues](https://github.com/spryker/architecture-sniffer/issues)[1 PRs](https://github.com/spryker/architecture-sniffer/pulls)20MITPHPPHP &gt;=8.3CI passing

Since Apr 8Pushed 2w ago65 watchersCompare

[ Source](https://github.com/spryker/architecture-sniffer)[ Packagist](https://packagist.org/packages/spryker/architecture-sniffer)[ Docs](https://spryker.com)[ RSS](/packages/spryker-architecture-sniffer/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (30)Versions (27)Used By (20)

Architecture Sniffer
====================

[](#architecture-sniffer)

[![CI](https://github.com/spryker/architecture-sniffer/workflows/CI/badge.svg?branch=master)](https://github.com/spryker/architecture-sniffer/actions/workflows/ci.yml)[![Coverage](https://camo.githubusercontent.com/44ba8322a3bd09adaa76cd96cb8bc55a77821ba37c3460c890d742aceb97482c/68747470733a2f2f636f6465636f762e696f2f67682f737072796b65722f6172636869746563747572652d736e69666665722f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d34414b434b4d52673347)](https://codecov.io/gh/spryker/architecture-sniffer)[![Latest Stable Version](https://camo.githubusercontent.com/f4bb38eceebdf9001215bd312357aecf59c8124141a0898b1e2dba6074a98585/68747470733a2f2f706f7365722e707567782e6f72672f737072796b65722f6172636869746563747572652d736e69666665722f762f737461626c652e737667)](https://packagist.org/packages/spryker/architecture-sniffer)[![Minimum PHP Version](https://camo.githubusercontent.com/34a8f393a435452ec3ef7edcb506c3efa0e879b3d8b337d3e1f73e849bf56cc5/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e322d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/6406aba2f1f5dd0f5b25e0b748f7c8c6c9c974d9db12d617605de69f7aa41350/68747470733a2f2f706f7365722e707567782e6f72672f737072796b65722f6172636869746563747572652d736e69666665722f6c6963656e73652e737667)](https://packagist.org/packages/spryker/architecture-sniffer)[![Total Downloads](https://camo.githubusercontent.com/0c79739e123fe7e0032f0cec7fd42df4ada460d2f8493728cc4c1a9cefec2f0a/68747470733a2f2f706f7365722e707567782e6f72672f737072796b65722f6172636869746563747572652d736e69666665722f642f746f74616c2e737667)](https://packagist.org/packages/spryker/architecture-sniffer)

Architecture Sniffer for Spryker core, eco-system and applications.

The package ships two independent rulesets. Use the one that matches what you are working on:

RulesetForPathCoreSpryker core, eco-system and module development`vendor/spryker/architecture-sniffer/src/ruleset.xml`ProjectApplication (project) development`vendor/spryker/architecture-sniffer/src/Project/ruleset.xml`Make sure the sniffer is installed as a `require-dev` dependency:

```
composer require --dev spryker/architecture-sniffer

```

Common to both: lower priorities (higher numbers) always include the higher priorities (lower numbers) — a run at priority `3` also reports `1` and `2`.

Spryker Core Development
------------------------

[](#spryker-core-development)

Use the core ruleset `src/ruleset.xml`.

### Priority Levels

[](#priority-levels)

- `1`: API and critical
- `2`: Non critical (nice to have)
- `3`: Experimental (inspected code needs further fixing)

We use and recommend minimum priority `2` by default for local and CI checks.

### Usage

[](#usage)

When using Spryker you can use the Spryker CLI console command:

```
console code:sniff:architecture [-m ModuleName] [optional-sub-path] -v [-p priority]

```

Verbose output is recommended here.

Or run it manually:

```
vendor/bin/phpmd src/Pyz/ (xml|text|html) vendor/spryker/architecture-sniffer/src/ruleset.xml --minimumpriority=2

```

### Including the sniffer in PHPStorm

[](#including-the-sniffer-in-phpstorm)

Add a new custom ruleset under `Editor -> Inspections -> PHP -> PHP Mess Detector validation` and name it `Architecture Sniffer`. The ruleset is defined in `vendor/spryker/architecture-sniffer/src/ruleset.xml`.

Under `Framework & Languages -> PHP -> Mess Detector` set the path to your phpmd (`vendor/bin/phpmd`), then run `Validate` to confirm it works.

Spryker Project Development
---------------------------

[](#spryker-project-development)

Use the project ruleset `src/Project/ruleset.xml`. It bundles adapted PHPMD, Spryker architecture, and project-only rules.

### Priority Levels

[](#priority-levels-1)

- `1`: Critical
- `2`: Major
- `3`: Medium
- `4`: Minor

Recommended minimum priority per project maturity:

- `1` and `2`: recommended for **all** projects, including those with legacy code.
- `3`: recommended for all **new** projects.
- `4`: recommended for a **modern AI-assisted development** flow.

### Usage

[](#usage-1)

```
vendor/bin/phpmd src/ (json|text|html) vendor/spryker/architecture-sniffer/src/Project/ruleset.xml --minimumpriority=4

```

### Setup for the project &amp; customizing rules

[](#setup-for-the-project--customizing-rules)

The project ruleset is meant to be tuned per project. Create a thin project-level `phpmd.xml` in the project root (PHPMD's conventional default filename) that references the vendor project ruleset, then layer your customizations on top of it — exclude modules, change priorities, or adjust rule properties without touching the vendor package:

```

    Project architecture ruleset.

    */Generated/*
    */Orm/*

```

After that, run phpmd against your project-level ruleset instead of the vendor one, and change it freely for project needs:

```
vendor/bin/phpmd src/ (json|text|html) phpmd.xml --minimumpriority=4

```

The commands below use this project-level path.

### Local Code Review Usage

[](#local-code-review-usage)

For a local review, save the report to JSON and format it into a grouped, human-readable summary.

Save the report (scan all priorities for an AI-assisted review):

```
vendor/bin/phpmd src/ json vendor/spryker/architecture-sniffer/src/Project/ruleset.xml --minimumpriority 4 --reportfile architecture-results.json

```

or

```
vendor/bin/phpmd src/ json phpmd.xml --minimumpriority 4 --reportfile architecture-results.json

```

Format it:

```
vendor/bin/spryker-architecture format-project-results architecture-results.json []

```

Without `` the formatted report is printed to stdout.

### Baseline

[](#baseline)

Adopt the ruleset on an existing project without refactoring legacy code first: generate a baseline of the current violations and only fail on new ones.

```
# generate phpmd.baseline.xml in the project root
vendor/bin/phpmd src/ text phpmd.xml --generate-baseline

# subsequent runs ignore baselined violations
vendor/bin/phpmd src/ text phpmd.xml --baseline-file phpmd.baseline.xml

```

Use `--update-baseline` to drop violations that no longer exist. Store the baseline in version control and shrink it over time.

### Debugging

[](#debugging)

Enable Xdebug for phpmd to step through rule code:

```
docker/sdk cli -x

```

```
PHPMD_ALLOW_XDEBUG=true vendor/bin/phpmd src/Pyz/ text phpmd.xml

```

Writing new sniffs
------------------

[](#writing-new-sniffs)

Add them to inside src folder and add tests in `tests` with the same folder structure. Don't forget to update `ruleset.xml`.

Every sniff needs a description as full sentence:

```
    protected const RULE = 'Every Foo needs Bar.';

    /**
     * @return string
     */
    public function getDescription(): string
    {
        return static::RULE;
    }
```

Every sniff needs to implement either the `ClassAware`, `FunctionAware`, `InterfaceAware`, or `MethodAware` interface to be recognised. To validate that sniffer recognises your rule, check if your rule is listed in Zed UI &gt; Maintenance &gt; Architecture sniffer.

Also note:

- The rule names must be unique across the rulesets.
- Each rule should contain only one "check".
- Each rule always outputs also the reason (violation), not just the occurrence.

### Setup

[](#setup)

Run

```
./setup.sh

```

and

```
php composer.phar install

```

### Testing

[](#testing)

Don't forget to test your changes:

```
php phpunit.phar

```

### Running code-sniffer on this project

[](#running-code-sniffer-on-this-project)

Make sure this repository is Spryker coding standard conform:

```
php composer.phar cs-check

```

If you want to fix the fixable errors, use

```
php composer.phar cs-fix

```

Once everything is green you can make a PR with your changes.

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance83

Actively maintained with recent releases

Popularity48

Moderate usage in the ecosystem

Community42

Growing community involvement

Maturity78

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~221 days

Recently: every ~320 days

Total

18

Last Release

20d ago

PHP version history (7 changes)0.1.0PHP &gt;=5.4.16

0.4.1PHP &gt;=7.1

0.5.1PHP &gt;=7.3

0.5.7PHP &gt;=7.4

0.5.8PHP &gt;=8.1

0.5.9PHP &gt;=8.2

0.6.0PHP &gt;=8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10738957?v=4)[Spryker Bot](/maintainers/spryker-bot)[@spryker-bot](https://github.com/spryker-bot)

---

Top Contributors

[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (138 commits)")[![zyuzka](https://avatars.githubusercontent.com/u/12764988?v=4)](https://github.com/zyuzka "zyuzka (73 commits)")[![stereomon](https://avatars.githubusercontent.com/u/1382877?v=4)](https://github.com/stereomon "stereomon (62 commits)")[![pushokwhite](https://avatars.githubusercontent.com/u/4017411?v=4)](https://github.com/pushokwhite "pushokwhite (25 commits)")[![geega](https://avatars.githubusercontent.com/u/1426310?v=4)](https://github.com/geega "geega (22 commits)")[![gerner-spryker](https://avatars.githubusercontent.com/u/30629375?v=4)](https://github.com/gerner-spryker "gerner-spryker (11 commits)")[![a-sabaa](https://avatars.githubusercontent.com/u/1667759?v=4)](https://github.com/a-sabaa "a-sabaa (10 commits)")[![olhalivitchuk](https://avatars.githubusercontent.com/u/77281282?v=4)](https://github.com/olhalivitchuk "olhalivitchuk (9 commits)")[![profuel](https://avatars.githubusercontent.com/u/3640652?v=4)](https://github.com/profuel "profuel (8 commits)")[![asaulenko](https://avatars.githubusercontent.com/u/20285714?v=4)](https://github.com/asaulenko "asaulenko (6 commits)")[![FabianWesner](https://avatars.githubusercontent.com/u/2893035?v=4)](https://github.com/FabianWesner "FabianWesner (4 commits)")[![alex-galych](https://avatars.githubusercontent.com/u/18210425?v=4)](https://github.com/alex-galych "alex-galych (3 commits)")[![asmarovydlo](https://avatars.githubusercontent.com/u/15832795?v=4)](https://github.com/asmarovydlo "asmarovydlo (3 commits)")[![gechetspr](https://avatars.githubusercontent.com/u/42143273?v=4)](https://github.com/gechetspr "gechetspr (3 commits)")[![romanhavrylko](https://avatars.githubusercontent.com/u/70894038?v=4)](https://github.com/romanhavrylko "romanhavrylko (3 commits)")[![spryker-release-bot](https://avatars.githubusercontent.com/u/26904324?v=4)](https://github.com/spryker-release-bot "spryker-release-bot (3 commits)")[![vitaliiivanovspryker](https://avatars.githubusercontent.com/u/70893950?v=4)](https://github.com/vitaliiivanovspryker "vitaliiivanovspryker (3 commits)")[![oliwier-spryker](https://avatars.githubusercontent.com/u/13624598?v=4)](https://github.com/oliwier-spryker "oliwier-spryker (2 commits)")[![AsonUnique](https://avatars.githubusercontent.com/u/20453760?v=4)](https://github.com/AsonUnique "AsonUnique (2 commits)")[![vol4onok](https://avatars.githubusercontent.com/u/5063777?v=4)](https://github.com/vol4onok "vol4onok (1 commits)")

---

Tags

standardsframeworkarchitecturesniffer

###  Code Quality

TestsCodeception

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spryker-architecture-sniffer/health.svg)

```
[![Health](https://phpackages.com/badges/spryker-architecture-sniffer/health.svg)](https://phpackages.com/packages/spryker-architecture-sniffer)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.9k556.2M21.5k](/packages/laravel-framework)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.9M535](/packages/pimcore-pimcore)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k257.3M12.4k](/packages/symfony-framework-bundle)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[oro/platform

Business Application Platform (BAP)

645146.3k118](/packages/oro-platform)

PHPackages © 2026

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