cooldevguys/phpstan-dhexpendency-rules
最新稳定版本:1.0.3
Composer 安装命令:
composer require cooldevguys/phpstan-dhexpendency-rules
包简介
A set of rules for PHPStan based on the Hexagonal architecture layers dependency
README 文档
README
A set of additional rules for phpstan. The intention of this rules is to foment to respect the dependency flow in a hexagonal architecture.
These rules assume that in the typical hexagonal architecture there are 3 layers: Infrastructure, Application and Domain.
There is a flow within these layers, this defines how the dependencies should interact to each other according the layer they are located in, and the flow is: Infrastructure ➡️ Application ➡️ Domain.
The interpretation of this flow is:
- The Infrastructure layer can "know" or communicate with the Application and Domain layers
- The Application layer can "known" or communicate ONLY with the Domain layer
- The Domain layer can ONLY communicate with itself
This ruleset attempts to help verifying the dependency flow is being applied properly in your project.
Installation
Run
composer require --dev cooldevguys/phpstan-dhexpendency-rules
If you use PHPStan extension installer, you're all set. If not, you need to manually register all the rules in your phpstan.neon file:
includes: - vendor/cooldevguys/phpstan-dhexpendency-rules/rules.neon
Configuration
You need to add your own values as parameters to your phpstan.neon:
parameters: myVendorName: CoolDevGuys vendorStrictMode: true ignoredExternalVendors: ['IgnoredVendor'] infrastructureLayerName: Infra applicationLayerName: App domainLayerName: Dom
myVendorName(string): Your project vendorvendorStrictMode(bool): Indicates if you want to validate that no external vendors are imported from Application or Domain layersignoredExternalVendors(string[]): A list of external vendors that you want to exclude from the checkinfrastructureLayerName(string): The name you define in your project for the Infrastructure layerapplicationLayerName(string): The name you define in your project for the Application layerdomainLayerName(string): The name you define in your project for the Domain layer
Rules
Currently there are two rules:
LayersDependencyFlowRuleNoExternalVendorsAllowedFromDomainRule
统计信息
- 总下载量: 189
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-31