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
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:
- Composer (http://getcomposer.org/)
But for image generation you need:
- Java Runtime
plantuml.jar(http://plantuml.sourceforge.net/)
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:
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\Bwill be evaluated and expanded butuse Namespace\B as Cis 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 OtherClassas "..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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 davidfuhr/php-plantumlwriter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Create UML class diagrams from your PHP source.
PHP GraphML Generator Class
Generate UML class diagrams by reflection for your PHP projects
Generate UML class diagrams by reflection for your PHP projects
Some architecture-related commands for Laravel developers
PHP classes for generating database models using yuml.me
统计信息
- 总下载量: 9.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 97
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2013-06-30