PHPackages                             jelix/dao - 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. jelix/dao

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

jelix/dao
=========

Lightweight object relation mapping based on the Database Access Object pattern

v1.1.0(2y ago)02.4kLGPL-2.1PHPPHP &gt;=7.4

Since Aug 18Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/jelix/JelixDao)[ Packagist](https://packagist.org/packages/jelix/dao)[ Docs](https://jelix.org)[ RSS](/packages/jelix-dao/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (6)Used By (0)

JelixDao
========

[](#jelixdao)

A lightweight object relation mapping based on the Database Access Object pattern.

It uses [JelixDatabase](https://github.com/jelix/JelixDatabase/) as database connector.

installation
------------

[](#installation)

You can install it from Composer. In your project:

```
composer require "jelix/dao"

```

Usage
-----

[](#usage)

First create a file `article.xml` describing the mapping:

```

```

Then use the JelixDao API to manipulate objects:

```
use \Jelix\Database\AccessParameters;
use \Jelix\Database\Connection;
use \Jelix\Dao\DaoLoader;

// create a connector to the database
$accessParameters = new AccessParameters(
    array(
      'driver'=>'sqlite3',
      "database"=>"/...../tests.sqlite3",
    ),
    array('charset'=>'UTF-8')
);

$connector = Connection::create($accessParameters);

// path to a directory where compiled class can be stored
$tempPath = '...';

// path to a directory where to find dao xml files
$daosDirectory = '...';

// instance of a dao loader, using a Context object
$loader = new DaoLoader(
    new \Jelix\Dao\Context(
        $connector,
        $tempPath,
        $daosDirectory
    )
);

$daoName = 'article'; // this the filename without path and extension

$dao = $loader->get($daoName);

// Storing a new object

$article = $dao->createRecord();
$article->title = "My title";
$article->content = "Lorem Ipsum";
$dao->insert($article);

echo "id of the new article: ".$article->id."\n";

// Query all records from the article table
$list = $dao->findAll();
foreach($list as $record) {
    echo $record->title;
}

// retrieve a single record
$artId = 1;
$article = $dao->get($artId);
echo $article->title;

// updating the record
$article->title = 'New title';
$dao->update($article);

// deleting a record
$dao->delete($article->id);

//...
```

Main features
-------------

[](#main-features)

- Database type abstraction
- support of schema into table names (ignored in database that don't support schemas)
- Generate PHP classes for record, and for factories. Factory classes implement SQL queries that are mostly generated during compilation time, so they are not generated each time you call factories API.
- Generated factory classes have some common methods, but can also have custom methods (so custom queries) declared into the dao file
- Generated factory classes and record classes can inherits from your own classes.
- A dao file can import the definition of an other dao file
- support of json types: json content can be decoded/encoded dynamically, to/from anonymous object or your own classes.
- support of events: generated methods can dispatch an event before or after the query
- support of a listener class (hooks)
- support of automatic encoding/decoding for json fields

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

[](#requirements)

One of these database servers:

- Postgresql 13+
- Mysql 8+
- Sqlite, SQLServer
- Oracle (support not actively tested, help needed ;-))

Documentation
-------------

[](#documentation)

The documentation is available into [the docs directory](docs/index.md).

History
-------

[](#history)

This library has been extracted from the [Jelix](https://jelix.org) framework 1.7/1.8, and has been modernized a bit since. Except class names, API of factories and records are mostly the same. The XML format of dao file is the same as in Jelix 1.6/1.7/1.8.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance53

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~314 days

Total

5

Last Release

111d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

1.x-devPHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae8142be36568660282368ce7c1eec904ecbc515ab5b58c759a487f3a6f1d114?d=identicon)[laurentj](/maintainers/laurentj)

![](https://www.gravatar.com/avatar/baa42c7323bbc9245b0c70f770031383879941a1a813f678f2835699fd50b375?d=identicon)[mdouchin](/maintainers/mdouchin)

---

Top Contributors

[![laurentj](https://avatars.githubusercontent.com/u/336034?v=4)](https://github.com/laurentj "laurentj (83 commits)")

---

Tags

databaseormdao

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jelix-dao/health.svg)

```
[![Health](https://phpackages.com/badges/jelix-dao/health.svg)](https://phpackages.com/packages/jelix-dao)
```

###  Alternatives

[cycle/database

DBAL, schema introspection, migration and pagination

64690.9k31](/packages/cycle-database)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[perplorm/perpl

Perpl is an improved and still maintained fork of Propel2, an open-source Object-Relational Mapping (ORM) for PHP.

203.7k](/packages/perplorm-perpl)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
