semitexa/orm
Composer 安装命令:
composer require semitexa/orm
包简介
Semitexa ORM — attribute-driven schema, connection pooling, MySQL adapter
README 文档
README
Attribute-driven ORM with schema definition, connection pooling, and MySQL 8.0+ support.
Schema migrations are owned by this package.
orm:diff(preview) andorm:sync(apply) are the only entry points that change database structure. Other Semitexa packages — includingsemitexa/update— must not issue schema DDL; they call ORM through a public seam and the ORM remains the source of truth for what the schema should look like. Post-schema data patches (backfills, normalizations) belong tosemitexa/update.
Purpose
Maps PHP classes to database tables using PHP 8.4 attributes. Provides Swoole-compatible connection pooling, typed column definitions, relation mapping, and a filtering architecture with auto-indexed filterable fields.
The source of truth for schema is the entity classes themselves (#[FromTable], #[Column], #[Index], #[BelongsTo]/#[HasMany]/etc.). There is no canonical migrations/ directory in a Semitexa project — the diff/sync engine produces the necessary DDL from the entity model, applies safe-rename / deprecate-then-drop policies, and gates destructive operations behind an explicit operator opt-in.
Role in Semitexa
Depends on Core and Tenancy. Depended on by Cache, Media, Scheduler, Search, Storage, Workflow, and Platform modules. Central persistence layer for all database-backed functionality.
Key Features
#[FromTable],#[Column],#[PrimaryKey],#[Index]for schema definition- Relations:
#[BelongsTo],#[HasMany],#[OneToOne],#[ManyToMany] #[Filterable]with auto-indexing and typedfilterByX()methods#[Aggregate]for virtual computed fields- Traits:
HasTimestamps,SoftDeletes,HasUuid,HasUuidV7(BINARY(16) chronological) - Domain mapping via
ResourceModel,#[AsMapper], andDomainRepository - Swoole
Channel-based connection pool - MySQL 8.0+ with version detection and capability checks
SchemaCollectorfor attribute-driven schema sync
Notes
ORM resources go in Application/Db/MySQL/Model/. Domain entities live in Domain/Model/. The Resource folder is reserved for response DTOs. Connection pooling is Swoole-native using Channel-based leasing.
Operator commands
| Command | Purpose |
|---|---|
orm:status |
Show driver capabilities, schema summary, and pending diff |
orm:diff |
Print the DDL plan to bring the database in sync with the entity model |
orm:sync |
Execute the DDL plan; supports --dry-run and --allow-destructive |
orm:seed |
Apply data seeds (fixture data) declared by entity factories |
Update orchestration calls orm:sync through Semitexa\Update\Domain\Contract\OrmMigrationGatewayInterface — never by reaching into ORM internals.
semitexa/orm 适用场景与选型建议
semitexa/orm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 150 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「mysql」 「schema」 「attributes」 「semitexa」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 semitexa/orm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 semitexa/orm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 semitexa/orm 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Kinikit - PHP Application development framework MVC component
Extension for Opis JSON Schema
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
EAV modeling package for Eloquent and Laravel.
serialize Symfony Forms into JSON schema
统计信息
- 总下载量: 150
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 26
- 依赖项目数: 18
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-22