bastien-wink/php-class-diagram
Composer 安装命令:
composer require bastien-wink/php-class-diagram
包简介
A CLI tool that parses the PHP source directory and outputs PlantUML scripts.
README 文档
README
A CLI tool that parses the PHP source directory and outputs PlantUML class diagram scripts.
Forked from https://packagist.org/packages/smeghead/php-class-diagram
Features
- Generating class diagrams from source code helps improve continuous design.
- Generates expressive class diagrams with an emphasis on namespaces and relationships.
- A simple CLI tool that is easy to handle.
- It is also possible to output a package relationship diagram that visualizes the dependency on the external namespace.
php-class-diagram class diagram
php-class-diagram package related diagram
Install
From DockerHub
You can use docker image includes php-class-diagram and plantuml, from below URL.
From Composer
$ mkdir sample
$ cd sample
$ composer init
$ composer require --dev smeghead/php-class-diagram
you can execute ./vendor/bin/php-class-diagram.
for instance, try to display help message.
$ vendor/bin/php-class-diagram --help usage: php-class-diagram [OPTIONS] <target php source directory> A CLI tool that parses the PHP source directory and outputs PlantUML class diagram scripts. OPTIONS -h, --help show this help page. --class-diagram output class diagram script. (default) --package-diagram output package diagram script. --jig-diagram output class diagram and package diagram script. --enable-class-properties describe properties in class diagram. (default) --disable-class-properties not describe properties in class diagram. --enable-class-methods describe methods in class diagram. (default) --disable-class-methods not describe methods in class diagram. --php5 parse php source file as php5. --php7 parse php source file as php7. --php8 parse php source file as php8. (not suppoted)
How to execute
When three php source files that TYPE commented exist in test/fixtures/no-namespace,
- php source files.
└─test
└─fixtures
└─no-namespace
└─product
Product.php
Name.php
Price.php
- Product.php
<?php class Product { /** @var Name product name. */ private $name; /** @var Price price of product. */ private $price; }
- Name.php
<?php class Name { /** @var string name. */ private $name; }
- Price.php
<?php class Price { /** @var int price. */ private int $price; }
To execute php-class-diagram will print PlantUML script.
$ vendor/bin/php-class-diagram test/fixtures/no-namespace @startuml class-diagram package product as product <<Rectangle>> { class product.Price { -price : int } class product.Name { -name : string } class product.Product { -name : Name -price : Price +method1(param1) } } product.Product ..> product.Name product.Product ..> product.Price @enduml
Use PlnatUML to convert the PlantUML script to an image.
Development
Open shell
docker-compose build docker-compose run --rm php_cli bash
install dependencies
composer install
execute tests
composer test
bastien-wink/php-class-diagram 适用场景与选型建议
bastien-wink/php-class-diagram 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 919 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 11 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bastien-wink/php-class-diagram 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bastien-wink/php-class-diagram 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 919
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-11-16


