brunner-medien/pimcore-plantuml
Composer 安装命令:
composer require brunner-medien/pimcore-plantuml
包简介
PlantUML class diagram generation based on pimcore class definitions
README 文档
README
Requirements
- Pimcore >= 10
Introduction
This bundle lets you create UML class diagrams based on the class definition as defined in your project. Actually your workflow normally is the other way around - you set up Pimcore based on your project's requirements, which probably involves some modelling.
However too often hand-crafted models get outdated. This is where this bundle becomes useful. It creates the source code for PlantUML, which is a (human readable) text based UML rendering engine.
PlantUmlBundle does not create the diagram image file for you, but the plantuml source. This is for following reasons:
- Having the source code, you still can edit and version control your diagram
- PlantUML has great IDE integration (PhpStorm, VisualCode, Atom all have their PUML extensions)
If you just want to play around with it, there is an online renderer available: https://plantuml.com/plantuml.
Supported data types
All Pimcore native data types are supported, namely:
- Simple types (like text, date, number, geolocation, quantityValues, ...)
- All Relation types, including advanced
- Blocks
- Classification store
- Field collections
- Object bricks
- Assets and Documents with their sub types
Installation
Nothing fancy here, just install via composer and enable via Pimcore backend or console command:
$ composer req brunner-medien/pimcore-plantuml
$ bin/console pimcore:bundle:enable PlantUmlBundle
Usage
The PlantUmlBundle has a backend integration in Pimcore "Settings" > "PlantUML". This menu (along with all admin API calls) is available for the admin user only.
Each configuration has its own scope. Imagine you have a large project with dozens of objects - a single class diagram showing all classes probably would not be very helpful. Instead, you select from the "Object" namespace tree at least one or more "seed" objects. Starting with these seeds, all related items become part of your class diagram.
This way, you can break down your diagram into different aspects, showing only the information that is relevant from one point of view.
Translations
If you have your class names and field labels translated (using admin translations), you can choose to use these. For class properties, the technical (getter) names are shown as well.
Templates
PlantUML source code is generated using Twig. Feel free to adjust the default template, or register your own.
config.yml:
plant_uml:
templates:
-
name: 'CustomTemplate'
path: '@AppBundle/PlantUml/_templates/custom_template'
Classes and Stereotypes
Generating a class diagram from Pimcore's class (and object brick / classification store) definitions usually generates some extra classes that have not been explicitly defined. This is necessary in order to retain correct multiplicity annotations. A block field for example yields a dedicated class with its own properties and associations, having a "0..n" association of type Composition where n is the amount of allowed blocks as defined in the block field. Non-object classes have their own stereotypes and are displayed in different colors.
Association classes
When a relation allows multiple objects (or document / asset types), things get slightly more complicated. There is no "standard" way to visualize such a relation in a class diagram. PlantUmlBundle creates a so called "association class" - an anonymous class visualized by a diamond shape. The allowed classes then "realize" this association class, hence have an association of type Realization. This probably may not be pure standard UML, but again helps to visualize your relations as correct as possible.
Relation classes
Relations of type "Advanced many-to-many" also create a dedicated class in between the two related classes. These "relation classes" have their own stereotype "relation".
Generalization associations
Generalization associations are created for Documents and Assets and their subtypes (like Image, Video, Archive etc).
Example
This basic example shows some of PlantUmlBundle's features:
- "Product" object has a Pimcore block field called "usps", where up to 5 blocks are allowed.
- "Product" object has an "Advanced many-to-many" relation named "assets".
- The relation allows to define a "doctype" property in the relation class.
- Allowed asset subtypes for this relation are "Document" and "Archive", both generalize the "Asset" class.
- The "heroImage" is an image field type that is mandatory, hence a "1..1" relation.
- The "images" is a "0..*" relation of Pimcore field type image gallery.
- Both "heroImage" and "images" relate to "Image", which also generalizes "Asset".
- Product's and Color's properties "name" are localized fields, indicated by the globe symbol.
- Product's "length" and "width" properties are quantity values, where [m,cm,mm] are valid units.
Generated PUML:
@startuml
hide empty attributes
hide empty methods
hide circle
skinparam shadowing false
skinparam classFontStyle Bold
skinparam ActivityBackgroundColor Silver
skinparam ActivityBorderColor DimGray
skinparam class {
BackgroundColor Cornsilk
ArrowColor DimGray
BorderThickness 1
BorderColor DimGray
BackgroundColor<<block>> Silver
BackgroundColor<<objectbrick>> LightPink
BackgroundColor<<fieldcollection>> LightPink
BackgroundColor<<classification>> LightPink
BackgroundColor<<asset>> PowderBlue
BackgroundColor<<document>> PaleGreen
}
title "Class diagram sample"
class "Image" as Asset\Image <<asset>> {
}
class "Asset" as Asset <<asset>> {
}
class "Category" as Object\Category {
**name**: varchar[190] / input
}
class "Color" as Object\Color {
**name**: varchar[190] / input <&globe>
}
class "Product" as Object\Product {
**gtin**: varchar[190] / input
**name**: varchar[190] / input <&globe>
**description**: text / wysiwyg <&globe>
**length**: float / quantityValue [m/cm/mm]
**width**: float / quantityValue [cm/m/mm]
}
diamond Object\Product\Assets\Association
class "Archive" as Asset\Archive <<asset>> {
}
class "Document" as Asset\Document <<asset>> {
}
class "Assets" as Object\Product\Assets <<relation>> {
**doctype**: select
}
class "Usps" as Object\Product\Usps <<block>> {
**title**: varchar[190] / input
**description**: text / wysiwyg
}
Asset\Image --|> Asset
Asset\Archive ..|> Object\Product\Assets\Association
Asset\Archive --|> Asset
Asset\Document ..|> Object\Product\Assets\Association
Asset\Document --|> Asset
Object\Product "0..*" --- "0..*" Object\Color : colors >
Object\Product "0..*" --- "0..1" Object\Category : category >
Object\Product "0..*" --- "1..1" Asset\Image : heroImage >
Object\Product "0..*" --- "0..*" Asset\Image : images >
Object\Product "0..*" ---- "0..*" Object\Product\Assets\Association : assets >
(Object\Product,Object\Product\Assets\Association) -- Object\Product\Assets
Object\Product "1..1" *-- "0..5" Object\Product\Usps : usps >
@enduml
brunner-medien/pimcore-plantuml 适用场景与选型建议
brunner-medien/pimcore-plantuml 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.75k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2021 年 04 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「pimcore」 「plantuml」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 brunner-medien/pimcore-plantuml 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 brunner-medien/pimcore-plantuml 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 brunner-medien/pimcore-plantuml 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Pimcore 5.x Website Indexer (powered by Zend Search Lucene)
Integration module allows to integrate Pimcore platform with Magento 2
Create UML class diagrams from your PHP source.
Database schema visualization
convert mysql schema to plantuml
Automatically translate and review your content via Lokalise.
统计信息
- 总下载量: 5.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: lgpl-3.0
- 更新时间: 2021-04-03