定制 vladitot/arch-inspector 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

vladitot/arch-inspector

最新稳定版本:v0.0.3

Composer 安装命令:

composer require vladitot/arch-inspector

包简介

A toolset for architecture check for php applications

README 文档

README

codecov

???? 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

  • RuleForSomeClass
  • RuleForSomeInterface
  • RuleForSomeMethod
  • RuleForSomeNamespace
  • RuleForSomeTrait

???? Available Filters

  • Each
  • UnderNamespace
  • WhichExtends
  • WhichHasAttribute
  • WhichImplements
  • WhichIsAbstract
  • WhichIsFinal
  • WithName

✅ Available Shoulds

  • NotBeHigherNLines
  • NotExist
  • NotHaveStaticMethods
  • NotHaveStaticVariables
  • NotToBeInANamespace
  • NotUseAnyClassExtendsSpecified

???? 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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固