定制 cooldevguys/phpstan-dhexpendency-rules 二次开发

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

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

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 vendor
  • vendorStrictMode (bool): Indicates if you want to validate that no external vendors are imported from Application or Domain layers
  • ignoredExternalVendors (string[]): A list of external vendors that you want to exclude from the check
  • infrastructureLayerName(string): The name you define in your project for the Infrastructure layer
  • applicationLayerName(string): The name you define in your project for the Application layer
  • domainLayerName(string): The name you define in your project for the Domain layer

Rules

Currently there are two rules:

  • LayersDependencyFlowRule
  • NoExternalVendorsAllowedFromDomainRule

统计信息

  • 总下载量: 189
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-31