Download the PHP package assegaiphp/orm without Composer
On this page you can find all versions of the php package assegaiphp/orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download assegaiphp/orm
More information about assegaiphp/orm
Files in assegaiphp/orm
Package orm
Short Description AssegaiORM is a standalone ORM for modern PHP applications, with optional AssegaiPHP integration.
License MIT
Informations about the package orm
A standalone ORM for modern PHP applications, with optional AssegaiPHP integration.
Description
An object-relational mapper for modern PHP applications. You can use it on its own, or plug it into AssegaiPHP when you want repository injection and framework conventions.
Contribution workflow
For commit and pull request conventions in this repo, see:
- docs/commit-and-pr-guidelines.md
Installation
That is the preferred path inside an Assegai workspace. It will:
- require
assegaiphp/ormif it is missing - import
OrmModuleinto the root module - make the ORM CLI commands available through package discovery
If you install the package manually first, assegai add orm is still safe to run afterward. It will just finish the
workspace wiring.
For standalone PHP projects that are not using Assegai, install the package directly:
Then enable only the PDO driver you actually plan to use:
pdo_mysqlfor MySQL or MariaDBpdo_pgsqlfor PostgreSQLpdo_sqlitefor SQLite
AssegaiORM no longer forces all three database extensions at install time. If you choose a driver without enabling its matching PDO extension, the ORM will tell you exactly which extension is missing when you try to connect.
Guide map
This package is designed to feel familiar to teams coming from TypeORM:
- entities describe persistence shape
- repositories can be used directly or injected into services in Assegai
- data sources decide where a feature reads and writes
- relations are explicit and ownership matters
- migrations evolve the schema deliberately
In the main Assegai guide set, the ORM track is:
core/docs/data-and-orm.mdcore/docs/orm-setup-and-data-sources.mdcore/docs/orm-entities-repositories-and-results.mdcore/docs/orm-relations.mdcore/docs/orm-migrations-and-database-workflows.md
Quick Start
Using it without Assegai
You can use AssegaiORM directly in any PHP project. The standalone path is:
- configure named databases for the ORM runtime
- create a
DataSource - create or fetch repositories from that data source
Hydrated reads
Reads retain their existing result shape by default. Pass hydrate: true when application code needs deterministic entity instances and entity property types:
The root row is a NoteEntity, and each explicitly requested relation is an instance of its declared target entity class. Column aliases are mapped to their entity property names, while backed enums, DateTime, and booleans use the ORM's normal conversion pipeline. Exclusion rules still apply after hydration, including sensitive-property defaults and explicit exclude overrides.
Using SQLite
SQLite is a good fit for local development, small apps, prototypes, and CLI tools. This ORM supports SQLite through PDO, so the first step is to register a named SQLite connection in your app config.
Make sure the pdo_sqlite extension is enabled and that the folder for your database file already exists. The
configured path should be relative to your project's working directory.
You can then point an entity at that SQLite data source:
When you need SQL-only storage knobs such as engine, schema, or SQLite WITHOUT ROWID, keep the entity metadata focused on shared concerns and add the SQL companion attribute:
Legacy #[Entity(engine: ...)], #[Entity(schema: ...)], and #[Entity(withRowId: ...)] declarations still work, but new code should put SQL-specific storage options on #[SqlEntityOptions(...)].
Relation mental model
Relations follow the same ownership ideas you would expect from TypeORM:
OneToOne: the owner side has#[JoinColumn(...)]ManyToOneandOneToMany: the foreign key lives on theManyToOnesideManyToMany: the owner side has#[JoinTable(...)]
Load relations explicitly in find() and findOne() calls, and prefer writing through the owner side of the relation. OneToMany collections do not need a reference-column argument; the ORM derives that from the owning ManyToOne/JoinColumn metadata.
If you want to use SQLite directly through the ORM, create a DataSource, ensure the table exists, and then work with
the repository:
Using it inside Assegai
Inside Assegai, import OrmModule once or let assegai add orm wire it for you. That module registers the repository
resolver so #[InjectRepository(...)] can participate in the framework injector cleanly.
Once the module is present, you can inject the repository and let the entity metadata select the SQLite connection:
Standalone first, framework optional
The ORM no longer needs assegaiphp/core to function. When the core package is present, the ORM can still read
framework config and repository metadata automatically. When it is not present, Assegai\\Orm\\Support\\OrmRuntime
acts as the lightweight runtime seam for config, module options, and logging.
Support
Assegai is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Andrew Masiye
- Website - https://assegaiphp.com
- Twitter - @assegaiphp
License
Assegai is MIT licensed.
All versions of orm with dependencies
ext-pdo Version *
ext-curl Version *
ext-intl Version *
assegaiphp/util Version ^0.10.0
psr/log Version ^3.0
symfony/console Version ^8.0
predis/predis Version ^2.3
