百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

deptrac

> 编程语言
开源

保持您的架构清洁。

3.0K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

保持您的架构清洁。

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

You can find the documentation in the /docs directory or visit the doc page: https://deptrac.github.io/deptrac

Getting Started

You can install Deptrac via Composer. We recommend using the deptrac package for this:

composer require --dev deptrac/deptrac

Once you have installed deptrac, you will need to create a configuration file, 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.php 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.php

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

You can analyse projects that require an older PHP version as long as nikic/php-parser can parse it.

How to Contribute

See the contribution guide.

Further Documentation

  • Backwards Compatibility - General info on how we approach backwards compatibility
  • Upgrade Guide - List of backwards breaking changes that need to be addressed when upgrading Deptrac to a new version and how to do it.
  • Core Concepts - Explains layers, rules and violations in more details.
  • Configuration - Reference for all available settings in a depfile
  • Collectors - Reference for which collectors are available in Deptrac to define your layers.
  • Formatters - Lists the different output formats supported by Deptrac
  • Debugging - Overview of the debug commands
  • Code Of Conduct - Our community standards
  • Contribute - Advice for contributing code changes, e.g. how to run tests or how to use your local changes to analyse your projects
  • Security Guide - How to report security vulnerabilities

GitHub Issues· 0 开放

在 GitHub 查看全部

暂无开放 Issues,或尚未同步最近议题。

核心特点

  • •Backwards Compatibility - General info on how we approach
  • •Upgrade Guide - List of backwards breaking changes that
  • •Core Concepts - Explains layers, rules and violations in
  • •Configuration - Reference for all available settings
  • •Collectors - Reference for which collectors are
  • •Formatters - Lists the different output formats
  • •Debugging - Overview of the debug commands
  • •Code Of Conduct - Our community standards
  • •Contribute - Advice for contributing code changes,
  • •Security Guide - How to report security vulnerabilities

> 标签

PHParchitectureclean-architecturephp

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言