# Searching for a simple ORM

**URL:** <https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020>\
**Category:** Questions\
**Created:** [December 26, 2024, 9:25pm UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020 "2024-12-26T21:25:29Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alpine418](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Alpine418](https://discourse.slimframework.com/u/Alpine418)\
**Post date:** [December 26, 2024, 9:25pm UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/1 "2024-12-26T21:25:29Z")

</div>

Hi folks.

I’m searching for an easy to use and simple ORM, matching the slimness patterns of Slim to create repositories, mappers and models of my tables from - or maybe generate them from an already existing DB schema as a plus. But without any annotations, non-PHP config files, DB migration support or even a DB modelling engine. Unfortunately most ORM are just overwhelming because they want to solve most or all DB-related narratives.

After a frustrated internet research I’ve asked the PHP folks in Reddit:  
[https://www.reddit.com/r/PHP/comments/1hmw6za/searching\_for\_a\_simple\_orm/](https://www.reddit.com/r/PHP/comments/1hmw6za/searching_for_a_simple_orm/)

Their response can be summarized as “use Doctrine (or maybe another Doctrine alternative)”

What do you guys use when you want to handle 4-10 tables with some relations and still keep it simple without a large overhead? To be honest, I’ve already created my own simple ORM, but for a better security feeling I wish I could migrate to a maintained public accessible alternative. Or I’m the only dude afraid to make the last step into Doctrine?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [December 26, 2024, 9:33pm UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/2 "2024-12-26T21:33:09Z")

</div>

Doctrine is also what comes to my mind when you ask about a ORM, but for me, a QueryBuilder is much easier and more efficient when working with relational databases.

---

<div class="post-metadata">

**Author:** ![trendschau](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/trendschau/32/1250_2.png) [@trendschau](https://discourse.slimframework.com/u/trendschau)\
**Post date:** [December 27, 2024, 8:02am UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/3 "2024-12-27T08:02:49Z")

</div>

I worked with the notorm library years ago but I don’t know if it is still updated. For input validation I combined it with valitron, then you have a quite slim toolset for validation and database queries …

---

<div class="post-metadata">

**Author:** ![Alpine418](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Alpine418](https://discourse.slimframework.com/u/Alpine418)\
**Post date:** [December 27, 2024, 10:36am UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/4 "2024-12-27T10:36:46Z")

</div>

Thanks for your response. I just want to handle my tables as easy to use models to add OOP for data handling. It really looks like there is no “simple” ORM out there.

Somebody already created a Slim ORM. Unfortunately it is not maintained anymore and also not complete.  
[GitHub - danielefavi/slim-orm: Slim ORM is a lightweight PHP ORM with an API interface similar to the Laravel’s ORM (Eloquent).](https://github.com/danielefavi/slim-orm)

Perhaps there really is a gap to be filled with a non-bloated, CRUD- and relation-only oriented ORM. Anyone interested in helping me create such a lib? I’ve already created a simple ORM, but it needs some love before it could be released or go public on GitHub.

What would you recommend as a simple query builder? Is it ok to create a Slim ORM based on DBAL or is there a better alternative?

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [December 27, 2024, 12:28pm UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/5 "2024-12-27T12:28:57Z")

</div>

The danielefavi/slim-orm package looks like a QueryBuilder and not like a ORM to me. The latest release was in 2022, so it might not be maintained anymore (like you said).

> What would you recommend as a simple query builder?

I have had the best experience with the [cakephp/database](https://github.com/cakephp/database) package. This is a very good and maintained / supported QueryBuilder from the CakePHP community.

I wrap that Connection class into a QueryFactory class. Example:

```php
$query = $this->queryFactory->newSelect('users');

$query->select(['id', 'username']);
$select->where(['id' => 1]);

$rows = $query->execute()->fetchAll('assoc');

foreach ($rows as $row) {
    print_r($row);
}

```

> Is it ok to create a Slim ORM based on DBAL or is there a better alternative?

I would not reinvent the wheel again in this case. You may also try other good query builders such as [cycle/database](https://github.com/cycle/database), [doctrine/dbal](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/), [laminas/laminas-db](https://github.com/laminas/laminas-db).

---

<div class="post-metadata">

**Author:** ![Alpine418](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Alpine418](https://discourse.slimframework.com/u/Alpine418)\
**Post date:** [December 27, 2024, 1:37pm UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/6 "2024-12-27T13:37:33Z")

</div>

Thank you!

But a query builder does not solve my needs to get a simple model layer into my application.

Right now, I have 4 classes to get a custom ORM for my needs (not finalized yet) plus some classes for a custom query builder. I only need to replace the query builder with a proper lib and I’m fine (except my custom ORM is not a well maintained lib).

It really looks like there is no simple and maintained ORM anymore. Idiorm was cool, but it is more dead than alive today.

> **[GitHub - j4mie/idiorm: A lightweight nearly-zero-configuration...](https://github.com/j4mie/idiorm)**
>
> A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.

---

<div class="post-metadata">

**Author:** ![aghezzi](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@aghezzi](https://discourse.slimframework.com/u/aghezzi)\
**Post date:** [December 30, 2024, 3:31pm UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/8 "2024-12-30T15:31:17Z")

</div>

the best I know and using for years  
[Idiorm](https://idiorm.readthedocs.io/en/latest/index.html)

it has a very low learning curve

---

<div class="post-metadata">

**Author:** ![macropay-solutions](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@macropay-solutions](https://discourse.slimframework.com/u/macropay-solutions)\
**Post date:** [December 30, 2024, 8:37pm UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/9 "2024-12-30T20:37:27Z")

</div>

We use eloquent in a lib that we published for filtered crud (via lumen or laravel). We asked if the slim community is interested in a version for slim that uses eloquent and the feedback was negative. [Url query language cruFd lib using Eloquent in Slim - #2 by tj\_gumis](https://discourse.slimframework.com/t/url-query-language-crufd-lib-using-eloquent-in-slim/5865/2)

---

<div class="post-metadata">

**Author:** ![LLEGAZ](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/llegaz/32/1665_2.png) [@LLEGAZ](https://discourse.slimframework.com/u/LLEGAZ)\
**Post date:** [January 5, 2025, 3:24pm UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/10 "2025-01-05T15:24:45Z")

</div>

If you are more of the Active Records type there Eloquent( [illuminate/database](https://packagist.org/packages/illuminate/database) ) and of course Propel:

[https://propelorm.org/](https://propelorm.org/)

---

<div class="post-metadata">

**Author:** ![Bruce](https://avatars.discourse-cdn.com/v4/letter/b/ccd318/32.png) [@Bruce](https://discourse.slimframework.com/u/Bruce)\
**Post date:** [June 4, 2025, 2:58am UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/11 "2025-06-04T02:58:21Z")

</div>

I might be a bit late to this discussion, but it sounds exactly like you are looking for the same thing I was.

Type in PHPFUI/ORM into Packagist.

Let me know of any questions.

---

<div class="post-metadata">

**Author:** ![avoutic](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@avoutic](https://discourse.slimframework.com/u/avoutic)\
**Post date:** [November 11, 2025, 2:47pm UTC](https://discourse.slimframework.com/t/searching-for-a-simple-orm/6020/12 "2025-11-11T14:47:18Z")

</div>

Maybe even later to the party.. But for a framework to bolt on to Slim, check out [WebFramework](https://web-framework.com). (I’m the dev). It was born out of the frustration of not wanting to use bloated frameworks like Laravel and Symfony, but don’t want to set up all the basics again and again.

WebFramework offers all the basics (authentication framework, events, queueing, database / ORM, caching, etc) and you can pick and choose (using PHP-DI).

There’s probably a lot missing because it’s made out of my usage scenarios. But open for any suggestions, comments and additions!
