ray/object-visual-grapher
Composer 安装命令:
composer require ray/object-visual-grapher
包简介
README 文档
README
Using ObjectGrapher to visualize Ray.Di applications
Grapher
When you've written a sophisticated application, Ray.Di's rich introspection API can describe the object graph in detail. This grapher exposes this data as an easily understandable visualization. It can show the bindings and dependencies from several classes in a complex application in a unified diagram.
Installation
You can install the ObjectGrapher with composer:
composer --dev require ray/object-visual-grapher
Generating a .dot file
Ray.Di's grapher leans heavily on GraphViz, an open source graph visualization package. It cleanly separates graph specification from visualization and layout. To produce a graph .dot file for an Injector, you can use the following code:
use Ray\ObjectGrapher\ObjectGrapher; $dot = (new ObjectGrapher)(new FooModule); file_put_contents('path/to/file', $dot);
The .dot file
Executing the code above produces a .dot file that specifies a graph. Each entry in the file represents either a node or an edge in the graph. Here's a sample .dot file:
digraph injector { graph [rankdir=TB]; dependency_BEAR_Resource_ResourceInterface_ [style=dashed, margin=0.02, label=<<table cellspacing="0" cellpadding="5" cellborder="0" border="0"><tr><td align="left" port="header" bgcolor="#ffffff"><font color="#000000">BEAR\\Resource\\ResourceInterface<br align="left"/></font></td></tr></table>>, shape=box] dependency_BEAR_Resource_FactoryInterface_ [style=dashed, margin=0.02, label=<<table cellspacing="0" cellpadding="5" cellborder="0" border="0"><tr><td align="left" port="header" bgcolor="#ffffff"><font color="#000000">BEAR\\Resource\\FactoryInterface<br align="left"/></font></td></tr></table>>, shape=box] dependency_BEAR_Resource_ResourceInterface_ -> class_BEAR_Resource_Resource [style=dashed, arrowtail=none, arrowhead=onormal] dependency_BEAR_Resource_FactoryInterface_ -> class_BEAR_Resource_Factory [style=dashed, arrowtail=none, arrowhead=onormal]
Rendering the .dot file
Download a Graphviz viewer for your platform, and use it to render the .dot file.
On Linux, you can use the command-line dot tool to convert .dot files into images.
dot -T png my_injector.dot > my_injector.png
Graph display
Edges:
- Solid edges represent dependencies from implementations to the types they depend on.
- Dashed edges represent bindings from types to their implementations.
- Double arrows indicate that the binding or dependency is to a
Provider.
Nodes:
- Implementation types are given black backgrounds.
- Implementation instances have gray backgrounds.
This document is mostly taken from https://github.com/google/guice/wiki/Grapher.
ray/object-visual-grapher 适用场景与选型建议
ray/object-visual-grapher 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 450.01k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2020 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ray/object-visual-grapher 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ray/object-visual-grapher 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 450.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 19
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-17
