semitexa/orm 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

semitexa/orm

最新稳定版本:2026.05.08.1640

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) and orm:sync (apply) are the only entry points that change database structure. Other Semitexa packages — including semitexa/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 to semitexa/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 typed filterByX() methods
  • #[Aggregate] for virtual computed fields
  • Traits: HasTimestamps, SoftDeletes, HasUuid, HasUuidV7 (BINARY(16) chronological)
  • Domain mapping via ResourceModel, #[AsMapper], and DomainRepository
  • Swoole Channel-based connection pool
  • MySQL 8.0+ with version detection and capability checks
  • SchemaCollector for 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.

统计信息

  • 总下载量: 118
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 14
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固