onurb/doctrine-yuml-bundle
Composer 安装命令:
composer require onurb/doctrine-yuml-bundle
包简介
Symfony Bundle to visualize the mapping of your entities with Yuml
README 文档
README
Bundle to visualise doctrine entities graph with yuml in Symfony4
This bundle is based on Marco Pivetta's work for zend doctrine ORM Module and zend developper tools
It uses the yuml.me api to display your project's objects mapping.
Installation
Symfony 4
Run the composer require onurb/doctrine-yuml-bundle command in your console
Adjust your parameters to personalize the render in config/packages/dev/yuml.yaml, or use annotations as describe bellow
Adjust the route (if you want to add a prefix) in config/routes/dev/yuml.yaml
Symfony 3
symfony 3 is not supported since 1.1.6, if you didn't migrate to SF4 yet, use version 1.1.5
- Add this bundle to your project as a composer dependency:
// composer.json { // ... require: { // ... "onurb/doctrine-yuml-bundle": "1.1.5" } }
- Declare the bundle in your application kernel:
// app/AppKernel.php public function registerBundles() { // ... if (in_array($this->getEnvironment(), array('dev', 'test'))) { // ... $bundles[] = new Onurb\Bundle\YumlBundle\OnurbYumlBundle(); } return $bundles; }
- Add this route in your global routing_dev configuration (with optional prefix)
# app/config/routing_dev.yml # ... doctrine_yuml: resource: "@OnurbYumlBundle/Resources/config/routing.yml" prefix: /my_prefix/
configure access to the yuml route (if you use security of course)
Use
Click on Doctrine icon added in the dev toolbar.
Run the yuml:mappings console command to save the image locally.
Personalize the render
Full personalisation for mapping rendering, defining parameters or using Metadatagrapher annotations
define the output file extension
Use the parameter file :
# app/config/parameters.yml => symfony 3 # config/packages/dev/yuml.yaml => symfony 4 parameters: onurb_yuml.extension: svg # ...
Extensions allowed : jpg, png (default), svg, pdf, or json
define the yuml rendering style
Use the parameter file :
# app/config/parameters.yml => symfony 3 # config/packages/dev/yuml.yaml => symfony 4 parameters: onurb_yuml.style: scruffy # ...
Styles allowed : plain (default), boring or scruffy
define the graph direction
Use the parameter file :
# app/config/parameters.yml => symfony 3 # config/packages/dev/yuml.yaml => symfony 4 parameters: onurb_yuml.direction: LR # ...
Directions allowed : LR (left to Right), RL (Right to Left), TB (Top to bottom => default).
define the graph scale
Use the parameter file :
# app/config/parameters.yml => symfony 3 # config/packages/dev/yuml.yaml => symfony 4 parameters: onurb_yuml.scale: huge # ...
Scales allowed : huge, big, normal (default), small or tiny.
Hide entities attributes properties (unique, type, length, ...)
Use the parameter file :
# app/config/parameters.yml => symfony 3 # config/packages/dev/yuml.yaml => symfony 4 parameters: onurb_yuml.show_fields_description: false # ...
this parameter is set to true by default since v1.1
Warning : In Symfony 3, don't forget to also define parameter keys in parameters.yml.dist to avoid symfony update
to clear your parameters
Toggle attributes properties on a specific class using annotations
to show only desired classes details if global parameter is set to false :
namespace My\Bundle\Entity use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher; /** * @Grapher\ShowAttributesProperties() */ Class MyClass { // ... }
And, if set to true (default), you can hide properties for a specific class :
namespace My\Bundle\Entity use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher; /** * @Grapher\HideAttributesProperties() */ Class MyClass { // ... }
Define colors for entities rendering
Define default color for a complete bundle or namespace by defining it in parameters.yml
# app/config/parameters.yml => Symfony 3 # config/packages/dev/yuml.yaml => Symfony 4 parameters: onurb_yuml.colors: App\Security: red App\Blog: blue # ...
You can also define colors for classes this way... but it is easier using annotations as described next
Complete list of yuml colors availables here
Define Entity color in graph using annotations
namespace My\Bundle\Entity use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher; /** * @Grapher\Color("blue") */ Class MyClass { }
Display specific entity method
You can display specific methods in the graph, using annotations
namespace My\Bundle\Entity use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher; // ... Class MyEntity { // ... /** * @Grapher\IsDisplayedMethod() */ public function myDisplayedMethod() { // ... } }
Hide columns
Hide all columns of the entity
If you want, you can hide Entity attributes with annotations : using annotation on the class :
/** * @Grapher\Hidecolumns */ MyEntity { //[...] }
Hide specific column
Or hide a specific secret column you want to hide, using annotation on the Entity column : (it could be usefull to hide you credential logic, or to avoid the display recurrent fields, like created_at, or updated_at in the graph...)
MyEntity
{
/**
* @ORM\Column(/* ... */)
* @Grapher\HiddenColumn
*/
private $secret;
}
Add notes to comment entities in the graph
use annotations :
namespace My\Bundle\Entity use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher; /** * @Grapher\Note("Some information about this class") */ Class MyClass { }
Notes are yellow by default, but you can customize note's' color
/** * @Grapher\Note(value="Some information about this class", color="blue") */
onurb/doctrine-yuml-bundle 适用场景与选型建议
onurb/doctrine-yuml-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 99.29k 次下载、GitHub Stars 达 41, 最近一次更新时间为 2015 年 07 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「bundle」 「doctrine」 「graph」 「mapping」 「uml」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 onurb/doctrine-yuml-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 onurb/doctrine-yuml-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 onurb/doctrine-yuml-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
The bundle for easy using json-rpc api on your project
Provide a way to secure accesses to all routes of an symfony application.
DMS Meetup API Bundle, enables Meetup API clients in services
Make pimcore migration simple
Bundle Symfony DaplosBundle
统计信息
- 总下载量: 99.29k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 43
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 4
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-22