定制 davidfuhr/php-plantumlwriter 二次开发

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

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

davidfuhr/php-plantumlwriter

最新稳定版本:1.6.0

Composer 安装命令:

composer create-project davidfuhr/php-plantumlwriter

包简介

A tool to create PlantUML class diagrams from your PHP source.

关键字:

README 文档

README

Build Status Scrutinizer Code Quality SensioLabsInsight License

Description

A tool to create PlantUML class diagrams from your PHP source.

Currently the following language features are supported:

  • Property and method visibility
  • Static properties and methods
  • Method return types from doc comment
  • Parameter types from type hinting and doc comment
  • Parameter default values
  • Class constants with value
  • Property types from doc comment
  • Property default values
  • Implemented interfaces and parent classes
  • Abstract classes

Requirements

To generate the PlantUML code a decent version of PHP will suffice. And you need Composer to install the dependencies:

But for image generation you need:

Phar generation

php-plantumlwriter uses Box 2 library to generate a single .phar file containing everything required for the usage.

To create the .phar file from sources just run:

$ box build

Usage

To generate the PlantUML code for WriteCommand.php run

php bin/php-plantumlwriter write src/Flagbit/Plantuml/Command/WriteCommand.php > WriteCommand.puml

which will output

@startuml
class Flagbit.Plantuml.Command.WriteCommand {
    #configure()
    #execute(input: Symfony.Component.Console.Input.InputInterface, output: Symfony.Component.Console.Output.OutputInterface)
}
class Flagbit.Plantuml.Command.WriteCommand extends Symfony.Component.Console.Command.Command
@enduml

Now you can convert your puml file to a png file.:

java -jar plantuml.jar WriteCommand.puml

The resulting png should look like this:

WriteCommand Class Diagram

If you have a large class with lots of methods you can suppress method printing using the --without-methods flag:

php bin/php-plantumlwriter write --without-methods path/to/your/LargeClass.php

Other available options are --without-properties and --without-constants.

You can also generate a whole directory at once:

php bin/php-plantumlwriter write path/to/directory

Or multiple files or directories:

php bin/php-plantumlwriter write path/to/ClassOne.php path/to/ClassTwo.php path/to/directory

Known Issues

  • Imported classes are currently not handled correctly if read from doc comment (use-Statement is not fully evaluated) which affects return values and property types. use Namespace\B will be evaluated and expanded but use Namespace\B as C is not yet de-aliased.
  • The Namespace Seperator is "." and not "".
  • Traits are not yet supported. See #4

Future Plans

  • Add support for class relations, maybe with quantifiers. This could be parsed from the doc comments. We could also guess the foreign quantifier (@var OtherClass as "..1" and @var OtherClass[] as "..*"), but we can't determine our quantifier. If doctrine annotations are present we can use them.
  • Evaluate Implementation of Visitor Pattern
  • Implement own set of Interfaces

Alternatives

davidfuhr/php-plantumlwriter 适用场景与选型建议

davidfuhr/php-plantumlwriter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.66k 次下载、GitHub Stars 达 96, 最近一次更新时间为 2013 年 06 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「uml」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 davidfuhr/php-plantumlwriter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 davidfuhr/php-plantumlwriter 我们能提供哪些服务?
定制开发 / 二次开发

基于 davidfuhr/php-plantumlwriter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 97
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 96
  • Watchers: 6
  • Forks: 24
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2013-06-30