PHPackages                             deptrac/deptrac - 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. deptrac/deptrac

ActiveLibrary

deptrac/deptrac
===============

Deptrac is a static code analysis tool that helps to enforce rules for dependencies between software layers.

4.6.0(3mo ago)2.9k6.3M—4.6%156[28 issues](https://github.com/deptrac/deptrac/issues)[2 PRs](https://github.com/deptrac/deptrac/pulls)20MITPHPPHP ^8.2CI failing

Since Mar 23Pushed 6d ago41 watchersCompare

[ Source](https://github.com/deptrac/deptrac)[ Packagist](https://packagist.org/packages/deptrac/deptrac)[ RSS](/packages/deptrac-deptrac/feed)WikiDiscussions 4.x Synced 1mo ago

READMEChangelog (10)Dependencies (20)Versions (74)Used By (20)

Deptrac
=======

[](#deptrac)

Deptrac is a static code analysis tool for PHP that helps you communicate, visualize and enforce architectural decisions in your projects. You can freely define your architectural layers over classes and which rules should apply to them.

For example, you can use Deptrac to ensure that bundles/modules/extensions in your project are truly independent of each other to make them easier to reuse.

Deptrac can be used in a CI pipeline to make sure a pull request does not violate any of the architectural rules you defined. With the optional Graphviz or Mermaidjs formatter you can visualize your layers, rules and violations.

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

[](#documentation)

You can find the documentation in the /docs directory or visit the doc page:

Getting Started
---------------

[](#getting-started)

You can install Deptrac via Composer. We recommend using the [deptrac](https://github.com/deptrac/deptrac) package for this:

```
composer require --dev deptrac/deptrac
```

Once you have downloaded/installed deptrac, you will need to create a [configuration file](docs/index.md#configuration), where you define your layers and communication ruleset. This configuration file is written in YAML or php and, by default, is stored with the name `deptrac.yaml` in your project's root directory.

Deptrac can generate a template for you, using the `init` command.

```
vendor/bin/deptrac init
```

When you have this file, you can analyse your code by running the `analyse` command:

```
vendor/bin/deptrac

# which is equivalent to
vendor/bin/deptrac analyse --config-file=deptrac.yaml
```

In order to run Deptrac you need at least PHP 8.1.

You can analyse projects that require an older PHP version as long as [nikic/php-parser](https://github.com/nikic/PHP-Parser) can parse it.

How to Contribute
-----------------

[](#how-to-contribute)

See the [contribution guide](docs/CONTRIBUTING.md).

Further Documentation
---------------------

[](#further-documentation)

- [Backwards Compatibility](docs/bc_policy.md) - General info on how we approach backwards compatibility
- [Upgrade Guide](docs/upgrade.md) - List of backwards breaking changes that need to be addressed when upgrading Deptrac to a new version and how to do it.
- [Core Concepts](docs/concepts.md) - Explains layers, rules and violations in more details.
- [Configuration](docs/configuration.md) - Reference for all available settings in a depfile
- [Collectors](docs/collectors.md) - Reference for which collectors are available in Deptrac to define your layers.
- [Formatters](docs/formatters.md) - Lists the different output formats supported by Deptrac
- [Debugging](docs/debugging.md) - Overview of the debug commands
- [Code Of Conduct](docs/CODE_OF_CONDUCT.md) - Our community standards
- [Contribute](docs/CONTRIBUTING.md) - Advice for contributing code changes, e.g. how to run tests or how to build a phar file with your changes that you can use to analyse your projects
- [Security Guide](docs/SECURITY.md) - How to report security vulnerabilities

###  Health Score

79

—

ExcellentBetter than 100% of packages

Maintenance90

Actively maintained with recent releases

Popularity74

Solid adoption and visibility

Community51

Growing community involvement

Maturity90

Battle-tested with a long release history

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

Recently: every ~15 days

Total

66

Last Release

106d ago

Major Versions

1.0.2 → 2.0.0-alpha2024-03-14

1.0.3 → 2.0.12024-06-17

2.0.4 → 3.0.x-dev2025-02-16

2.0.5 → 3.0.02025-02-17

2.0.7 → 4.0.02025-07-17

PHP version history (10 changes)0.2.0PHP ^7.0

0.4.0PHP ^7.1

0.6.0PHP ^7.2

0.7.0PHP ^7.2.5

0.10.0PHP ^7.2.5 || 8.0.\*

0.14.1PHP ^7.4.0 || 8.0.\*

0.16.0PHP ^7.4.0 || 8.0.\* || 8.1.\*

0.19.0PHP ^7.4 || ^8.0

1.0.0PHP ^8.1

4.5.0PHP ^8.2

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/7aff6ba3542124d7a4e86003ec276d9831730aebb01e50ed3960f7bc10b1cd8a?d=identicon)[dbrumann](/maintainers/dbrumann)

![](https://www.gravatar.com/avatar/819586bcb80d711ae053b12b6a36ae4ad2556eeeb39b52e10f78a94299dc7580?d=identicon)[gennadigennadigennadi](/maintainers/gennadigennadigennadi)

---

Top Contributors

[![patrickkusebauch](https://avatars.githubusercontent.com/u/1620948?v=4)](https://github.com/patrickkusebauch "patrickkusebauch (258 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (163 commits)")[![slde-flash](https://avatars.githubusercontent.com/u/7532909?v=4)](https://github.com/slde-flash "slde-flash (46 commits)")[![smoench](https://avatars.githubusercontent.com/u/183530?v=4)](https://github.com/smoench "smoench (41 commits)")[![dbrumann](https://avatars.githubusercontent.com/u/2952726?v=4)](https://github.com/dbrumann "dbrumann (40 commits)")[![gennadigennadigennadi](https://avatars.githubusercontent.com/u/3352744?v=4)](https://github.com/gennadigennadigennadi "gennadigennadigennadi (27 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (19 commits)")[![timglabisch](https://avatars.githubusercontent.com/u/689269?v=4)](https://github.com/timglabisch "timglabisch (19 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (18 commits)")[![DavidBadura](https://avatars.githubusercontent.com/u/470138?v=4)](https://github.com/DavidBadura "DavidBadura (18 commits)")[![DanielBadura](https://avatars.githubusercontent.com/u/2017762?v=4)](https://github.com/DanielBadura "DanielBadura (17 commits)")[![clxmstaab](https://avatars.githubusercontent.com/u/47448731?v=4)](https://github.com/clxmstaab "clxmstaab (16 commits)")[![jschaedl](https://avatars.githubusercontent.com/u/1880467?v=4)](https://github.com/jschaedl "jschaedl (10 commits)")[![theofidry](https://avatars.githubusercontent.com/u/5175937?v=4)](https://github.com/theofidry "theofidry (9 commits)")[![rubenrubiob](https://avatars.githubusercontent.com/u/9865569?v=4)](https://github.com/rubenrubiob "rubenrubiob (9 commits)")[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (8 commits)")[![oldy777](https://avatars.githubusercontent.com/u/913048?v=4)](https://github.com/oldy777 "oldy777 (7 commits)")[![sasezaki](https://avatars.githubusercontent.com/u/42755?v=4)](https://github.com/sasezaki "sasezaki (6 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (6 commits)")[![marekstodolny](https://avatars.githubusercontent.com/u/7403046?v=4)](https://github.com/marekstodolny "marekstodolny (5 commits)")

---

Tags

architectureclean-architecturephpdevstatic analysis

### Embed Badge

![Health badge](/badges/deptrac-deptrac/health.svg)

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

###  Alternatives

[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)

PHPackages © 2026

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