PHPackages                             initorm/orm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. initorm/orm

ActiveLibrary[Database &amp; ORM](/categories/database)

initorm/orm
===========

Lightweight, PDO-based ORM with Active Record-style models and entity accessors/mutators. Built on top of initorm/database, initorm/dbal and initorm/query-builder.

2.0.0(1mo ago)0722MITPHPPHP ^8.1CI passing

Since Dec 15Pushed 3w agoCompare

[ Source](https://github.com/InitORM/ORM)[ Packagist](https://packagist.org/packages/initorm/orm)[ Docs](https://github.com/InitORM/ORM)[ GitHub Sponsors](https://github.com/muhammetsafak)[ RSS](/packages/initorm-orm/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (5)Versions (6)Used By (2)

InitORM ORM
===========

[](#initorm-orm)

A lightweight, PDO-based ORM. Each subclass of [`Model`](src/Model.php) maps a table to an [`Entity`](src/Entity.php) class and exposes Active-Record-style CRUD on top of [`initorm/database`](https://github.com/InitORM/Database). Entities support per-column accessor and mutator hooks (Laravel-style), and models ship with optional timestamp columns, soft deletes, and per-operation permission gates.

[![Latest Stable Version](https://camo.githubusercontent.com/cc8008051bde7b88564e54adfaa63e93dd806ca5819513619ebdd5cf67f22186/68747470733a2f2f706f7365722e707567782e6f72672f696e69746f726d2f6f726d2f76)](https://packagist.org/packages/initorm/orm)[![Total Downloads](https://camo.githubusercontent.com/060d04cf346e89e1b20b95398acb691cdfae20b8a376868a7f1797bbc4c54db5/68747470733a2f2f706f7365722e707567782e6f72672f696e69746f726d2f6f726d2f646f776e6c6f616473)](https://packagist.org/packages/initorm/orm)[![License](https://camo.githubusercontent.com/f9efc4fb58866f156c455e10d531d01bf7f2c44053621e49b1b9ca750c0eb81a/68747470733a2f2f706f7365722e707567782e6f72672f696e69746f726d2f6f726d2f6c6963656e7365)](https://packagist.org/packages/initorm/orm)[![PHP Version Require](https://camo.githubusercontent.com/0f8b1bfda14a9236276420b7fc8246f1626e4fe8d245ddce661e4e89cdc4f74d/68747470733a2f2f706f7365722e707567782e6f72672f696e69746f726d2f6f726d2f726571756972652f706870)](https://packagist.org/packages/initorm/orm)[![PHPUnit](https://github.com/InitORM/ORM/actions/workflows/phpunit.yml/badge.svg)](https://github.com/InitORM/ORM/actions/workflows/phpunit.yml)[![PHPStan](https://github.com/InitORM/ORM/actions/workflows/phpstan.yml/badge.svg)](https://github.com/InitORM/ORM/actions/workflows/phpstan.yml)[![PHP_CodeSniffer](https://github.com/InitORM/ORM/actions/workflows/phpcs.yml/badge.svg)](https://github.com/InitORM/ORM/actions/workflows/phpcs.yml)

---

Requirements
------------

[](#requirements)

- **PHP 8.1 or later**
- `ext-pdo`
- One of `ext-pdo_mysql`, `ext-pdo_pgsql`, or `ext-pdo_sqlite` depending on the database you target.

Supported databases
-------------------

[](#supported-databases)

The full query-builder dialect support comes through `initorm/database`: **MySQL/MariaDB**, **PostgreSQL**, and **SQLite** ship with dialect-aware identifier quoting; any other PDO driver works through a no-escape generic driver.

Installation
------------

[](#installation)

```
composer require initorm/orm
```

`initorm/orm` pulls in `initorm/database`, `initorm/dbal`, and `initorm/query-builder` transitively — you do not need to require them yourself.

---

Quick start
-----------

[](#quick-start)

```
