PHPackages                             eman-development-design/leaf-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. eman-development-design/leaf-orm

Abandoned → [eman-development-design/mongodb-helpers](/?search=eman-development-design%2Fmongodb-helpers)ArchivedLibrary[Database &amp; ORM](/categories/database)

eman-development-design/leaf-orm
================================

A super light ORM-ish library for using MongoDB with PHP

1.0.1(8y ago)29[3 issues](https://github.com/eman-development-design/Leaf-Orm/issues)MITPHPPHP &gt;=7.1.0

Since Apr 13Pushed 6y agoCompare

[ Source](https://github.com/eman-development-design/Leaf-Orm)[ Packagist](https://packagist.org/packages/eman-development-design/leaf-orm)[ Docs](http://emandevelopmentdesign.com)[ RSS](/packages/eman-development-design-leaf-orm/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Leaf-Orm
========

[](#leaf-orm)

A super light ORM-ish library for using MongoDB with PHP

### This package has been depreciated, the new library to use is [MongoDB Helpers](https://github.com/eman-development-design/mongodb-helpers)

[](#this-package-has-been-depreciated-the-new-library-to-use-is-mongodb-helpers)

Requirement
-----------

[](#requirement)

- PHP 7.1 or newer
- MongoDB Extension 1.1 or newer

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

[](#installation)

`composer require eman-development-design/Leaf-Orm`

Usage
-----

[](#usage)

There's two simple items, a model and a repository object.

### Model

[](#model)

Consider the example below:

```
use MongoDB\BSON\Serializable;
use MongoDB\Model\BSONDocument;
use Leaf\Model\MongoModel

class User implements Serializable, MongoModel
{
    public $userGuid;
    public $email;
    public $firstName;
    public $lastName;

    public function bsonSerialize() : array
    {
        return [
            'UserGuid' => $this->userGuid,
            'Email' => $this->email,
            'FirstName' => $this->firstName,
            'LastName' => $this->lastName
        ];
    }

    public function map(BSONDocument $document)
    {
        $this->userGuid = $document['UserGuid'];
        $this->email = $document['Email'];
        $this->firstName = $document['FirstName'];
        $this->lastName = $document['LastName'];
    }

    public function toArray() : array
    {
        return [
            'UserGuid' => $this->userGuid,
            'Email' => $this->email,
            'FirstName' => $this->firstName,
            'LastName' => $this->lastName
        ];
    }
}
```

`map` will take a BSON Document and populate the model.

`toArray` will convert your model to an array.

### Repository

[](#repository)

`MongoRepository` is used for your repository layer, it only has one method, which is a way to fetch a collection.

Bugs, Suggestions
-----------------

[](#bugs-suggestions)

Fill out an issue ticket to report any issues or to suggest ideas to make this library better.

Contribute
----------

[](#contribute)

I welcome people who wish to contribute to this project, just create a pull request and I'll review all the changes.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

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 ~12 days

Total

2

Last Release

2942d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/96b5243c34bdd31f20345e5963f22d733c0b985b6b24a193eebcaeed968d7611?d=identicon)[eman-development-design](/maintainers/eman-development-design)

---

Top Contributors

[![eman1986](https://avatars.githubusercontent.com/u/2343334?v=4)](https://github.com/eman1986 "eman1986 (7 commits)")

---

Tags

librarymongodbormphp7ormmongodbmongo

### Embed Badge

![Health badge](/badges/eman-development-design-leaf-orm/health.svg)

```
[![Health](https://phpackages.com/badges/eman-development-design-leaf-orm/health.svg)](https://phpackages.com/packages/eman-development-design-leaf-orm)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[mmucklo/queue-bundle

Symfony2/3/4/5 Queue Bundle (for background jobs) supporting Mongo (Doctrine ODM), Mysql (and any Doctrine ORM), RabbitMQ, Beanstalkd, Redis, and ... {write your own}

120839.8k](/packages/mmucklo-queue-bundle)[sokil/php-mongo

PHP Object Document Mapper for MongoDB

239161.5k9](/packages/sokil-php-mongo)[moloquent/moloquent

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)

120114.6k7](/packages/moloquent-moloquent)[denchikby/phalcon-mongodb-odm

Phalcon MongoDB ODM

4212.8k](/packages/denchikby-phalcon-mongodb-odm)[leroy-merlin-br/mongolid

Easy, powerful and ultrafast ODM for PHP and MongoDB.

11234.3k4](/packages/leroy-merlin-br-mongolid)

PHPackages © 2026

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