vladitot/arch-inspector
最新稳定版本:v0.0.3
Composer 安装命令:
composer require vladitot/arch-inspector
包简介
A toolset for architecture check for php applications
README 文档
README
???? Arch Inspector (Archi)
Arch Inspector, or simply Archi, is a PHP architecture rules checker.
It helps you describe architectural rules for your project and enforce them across the team.
???? Features
- Define architectural rules in plain PHP.
- Automatically check your codebase against those rules.
- Easily integrate into your CI/CD pipeline.
- Simple to use and highly extensible.
???? Quick Start
1. Install Archi
Globally:
composer global require vladitot/arch-inspector
Or locally in your project:
composer require --dev vladitot/arch-inspector
2. Create the configuration file
Create a file named archi.php in the root of your project:
<?php return [ \Vladitot\ArchChecker\Rules\RuleForSomeNamespace::filter([ new \Vladitot\ArchChecker\Filters\Each(), ]) ->should([ new \Vladitot\ArchChecker\Should\NotExist(), ]) ->setRuleName('My Personal Rule Name'), ];
3. Run the check
./vendor/bin/archi c
4. Add to CI/CD (optional)
Make sure your code adheres to architectural rules automatically in your pipelines.
???? CLI Commands
./vendor/bin/archi c
Runs architecture checks based on your defined rules.
./vendor/bin/archi b
Generates a new baseline of current violations.
???? Rule Structure
Each rule consists of:
- A target (
RuleForSome*) - A set of filters
- One or more expectations (called "shoulds")
???? Available Rules
RuleForSomeClassRuleForSomeInterfaceRuleForSomeMethodRuleForSomeNamespaceRuleForSomeTrait
???? Available Filters
EachUnderNamespaceWhichExtendsWhichHasAttributeWhichImplementsWhichIsAbstractWhichIsFinalWithName
✅ Available Shoulds
NotBeHigherNLinesNotExistNotHaveStaticMethodsNotHaveStaticVariablesNotToBeInANamespaceNotUseAnyClassExtendsSpecified
???? Example Configuration
<?php use Vladitot\ArchChecker\Rules\RuleForSomeNamespace; use Vladitot\ArchChecker\Filters\Each; use Vladitot\ArchChecker\Should\NotExist; return [ RuleForSomeNamespace::filter([ new Each(), ]) ->should([ new NotExist(), ]) ->setRuleName('Disallow this namespace completely'), ];
???? Why Use Archi?
- Enforces architectural rules across your codebase.
- Acts as living documentation for your architecture.
- Prevents architectural drift and technical debt.
- Keeps code maintainable, scalable, and consistent.
???? Contributing
We welcome issues, pull requests, and ideas!
Let’s build a more structured PHP world together.
???? License
This project is licensed under the MIT License.
统计信息
- 总下载量: 7.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2026-01-04