vladitot/arch-inspector
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.
vladitot/arch-inspector 适用场景与选型建议
vladitot/arch-inspector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.86k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 02 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vladitot/arch-inspector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vladitot/arch-inspector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13.86k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-02-02