jonathanlight/meta-entity-builder-bundle
Composer 安装命令:
composer require jonathanlight/meta-entity-builder-bundle
包简介
Symfony bundle that generates Doctrine entities from YAML schemas with smart update detection, custom code preservation, and automatic backups
README 文档
README
A Symfony bundle that generates Doctrine entities from YAML schemas with smart update detection, custom code preservation, and automatic backups.
Features
- YAML-based schema definition — Define your entities in a clean YAML format
- Smart update detection — Only regenerates entities when the schema changes (MD5 checksums)
- Custom code preservation — Code between
// @custom-code-startand// @custom-code-endmarkers is preserved across regeneration - Automatic backups — Timestamped backups before any file is overwritten
- PHP 8 attributes — Generated entities use modern Doctrine ORM attributes (
#[ORM\Entity],#[ORM\Column], etc.) - Fluent setters — All setters return
$thisfor method chaining - Collection helpers — Automatic
add*/remove*methods for*ToManyrelations - Event-driven — Dispatches events on entity generation and update
Requirements
- PHP 7.4+
- Symfony 5.4 | 6.x | 7.x
- Doctrine ORM 2.10+ | 3.x
Installation
composer require jonathanlight/meta-entity-builder-bundle
Configuration
# config/packages/meta_entity_builder.yaml meta_entity_builder: schema_path: '%kernel.project_dir%/config/entities.yaml' entity_namespace: 'App\Entity' entity_directory: '%kernel.project_dir%/src/Entity' backup_enabled: true backup_directory: '%kernel.project_dir%/var/backups/entities' generate_repository: true repository_namespace: 'App\Repository' strict_mode: true
Schema Definition
Create your entity definitions in YAML:
# config/entities.yaml entities: User: table: users repository: App\Repository\UserRepository properties: id: type: integer id: true autoIncrement: true email: type: string length: 180 unique: true name: type: string length: 255 createdAt: type: datetime_immutable relations: posts: type: OneToMany targetEntity: Post mappedBy: author cascade: [persist, remove] orphanRemoval: true indexes: idx_email: [email] Post: table: posts properties: id: type: integer id: true autoIncrement: true title: type: string length: 255 content: type: text nullable: true published: type: boolean default: false relations: author: type: ManyToOne targetEntity: User inversedBy: posts joinColumn: name: author_id referencedColumnName: id
Usage
Generate entities
# Generate all entities php bin/console meta-generate:entity # Dry run (preview changes without writing files) php bin/console meta-generate:entity --dry-run # Force regeneration (ignore checksums) php bin/console meta-generate:entity --force # Generate a specific entity php bin/console meta-generate:entity --entity=User
Aliases available: meta:entity:generate, entity:generate
Custom Code Preservation
Generated entities include markers where you can add custom code:
class User { // ... generated properties and methods ... // @custom-code-start // Add your custom methods here — this block is preserved on regeneration public function getFullName(): string { return $this->firstName . ' ' . $this->lastName; } // @custom-code-end }
Events
The bundle dispatches the following events:
Meta\EntityBuilderBundle\Event\EntityGeneratedEvent— When a new entity is createdMeta\EntityBuilderBundle\Event\EntityUpdatedEvent— When an existing entity is updated
License
Apache License 2.0 — see LICENSE for details.
jonathanlight/meta-entity-builder-bundle 适用场景与选型建议
jonathanlight/meta-entity-builder-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「generator」 「yaml」 「schema」 「doctrine」 「entity」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jonathanlight/meta-entity-builder-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jonathanlight/meta-entity-builder-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jonathanlight/meta-entity-builder-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
The bundle for easy using json-rpc api on your project
Bundle Symfony DaplosBundle
SUML for PHP
SUML support for Symfony
provides an facade for php-yaml, syck and symphony/yaml so switching in between is easier
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 39
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2026-02-10