---
title: "Introduction"
description: "Doctrine ORM and DBAL configured from an array, and the repositories of Derafu over Doctrine entities. A proof of concept without a stable API"
type: "docs"
category: "doc"
tags: []
authors: [Anonymous]
date: "2026-10-26"
last_update: "2026-10-26"
time_minutes: 2
draft: false
unlisted: false
url: "https://www.derafu.dev/docs/data/orm/introduction"
---

# Models and Entities

[![GitHub](https://img.shields.io/badge/github-derafu%2Form-blue?logo=github)](https://github.com/derafu/orm)
![GitHub last commit](https://img.shields.io/github/last-commit/derafu/orm/main)
![CI Workflow](https://github.com/derafu/orm/actions/workflows/ci.yml/badge.svg?branch=main&event=push)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/derafu/orm)
![GitHub Issues](https://img.shields.io/github/issues-raw/derafu/orm)
![Total Downloads](https://poser.pugx.org/derafu/orm/downloads)
![Monthly Downloads](https://poser.pugx.org/derafu/orm/d/monthly)

> Since 2006, [I participated in FLISoL](https://flisol.info/FLISOL2006/Chile/Valparaiso). In 2014, I presented [SowerPHP at UTEM (Santiago, Chile)](https://www.cnsl.cl/index.php/noticias/81-blog/isabel/1063-programa-flisol-santiago-2014). Years before, I presented MiPaGiNa at the University of Chile. On that occasion, someone in the audience said to me "Oh, you built an ORM," and I said, "What is that?" That day, during the presentation I was giving, I learned what an ORM was. This project compiles the ideas that have appeared in my mind over the years. Always with the goal of making everything "automagical."
>
> -- <cite>Esteban De La Fuente Rubio</cite>

`derafu/orm` does not implement an ORM: it uses [Doctrine ORM](https://www.doctrine-project.org/projects/orm.html) and [DBAL](https://www.doctrine-project.org/projects/dbal.html). It is a library, not a framework bundle, and its API is not stable yet.

## Installation

PHP 8.5 or later is required.

```bash
composer require derafu/orm
```

## Components

| Class | Purpose |
|-------|---------|
| `EntityManagerFactory` | Create an `EntityManager` from an array of options (`EntityManagerFactoryInterface`) |
| `ConnectionParametersFactory` | Create the parameters of the connection, with its DSN (`ConnectionParametersFactoryInterface`) |
| `DoctrineRepositoryFactory`, `DoctrineRepository` | Give the entities of Doctrine through the repository manager of [derafu/repository](https://www.derafu.dev/docs/data/repository) |
| `DoctrineCliConfigurationFactory` | Create what the CLI of Doctrine Migrations needs, from a DSN or an array |

## Guides

- [Entity manager](https://www.derafu.dev/docs/data/orm/entity-manager): the `dbal` and `orm` options, with the types, the caches and the errors.
- [Repositories](https://www.derafu.dev/docs/data/orm/repositories): one repository manager for the entities of Doctrine and the data sources of `derafu/repository`.
- [Migrations](https://www.derafu.dev/docs/data/orm/migrations): the configuration of the CLI of Doctrine Migrations, without a framework.
- [Symfony integration](https://www.derafu.dev/docs/data/orm/symfony): wire the entity manager and the repository factory with Symfony DependencyInjection.



---
Last updated on 26/10/2026

