semitexa / orm
Semitexa ORM — attribute-driven schema, connection pooling, MySQL adapter
Requires
- php: ^8.4
- semitexa/core: >=2026.09.13.1330 || dev-master
- semitexa/tenancy: *
Requires (Dev)
- swoole/ide-helper: ^5.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 2026.09.13.1330
- 2026.09.13.0749
- 2026.09.11.1941
- 2026.09.08.2003
- 2026.09.05.1548
- 2026.09.02.1513
- 2026.09.02.0604
- 2026.08.21.0628
- 2026.08.19.2107
- 2026.08.19.1426
- 2026.08.12.0606
- 2026.08.06.1609
- 2026.08.06.1540
- 2026.08.06.1508
- 2026.08.04.2028
- 2026.07.28.1623
- 2026.07.25.0821
- 2026.07.23.0617
- 2026.07.20.0639
- 2026.07.11.0650
- 2026.07.11.0619-beta
- 2026.07.07.1936
- 2026.07.06.1438
- 2026.06.21.0352
- 2026.05.08.1640
- 2026.04.26.0639
- 2026.04.21.2047
- 2026.04.21.0704
- 2026.04.15.1848
- 2026.04.15.0921
- 2026.04.14.1121
- 2026.04.13.0911
- 2026.04.12.1209
- 2026.04.09.1145
- 2026.04.07.1133
- 2026.04.05.0855
- 2026.04.03.1349
- 2026.04.03.1240
- 1.0.23
- v1.0.22
- 1.0.20
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- dev-develop
- dev-chore/phpstan-baseline-cleanup
This package is auto-updated.
Last update: 2026-09-13 13:41:14 UTC
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.