PHPackages                             wolfy-j/lodm - 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. wolfy-j/lodm

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

wolfy-j/lodm
============

Laravel ODM module using Spiral ODM component.

v0.9.6(8y ago)211.8k1PHP

Since Dec 15Pushed 8y ago5 watchersCompare

[ Source](https://github.com/wolfy-j/lodm)[ Packagist](https://packagist.org/packages/wolfy-j/lodm)[ RSS](/packages/wolfy-j-lodm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (12)Used By (0)

ODM with inheritance and OOP composition for Laravel 5+
=======================================================

[](#odm-with-inheritance-and-oop-composition-for-laravel-5)

[![Latest Stable Version](https://camo.githubusercontent.com/44424dcee374d4be58b87ea7754814c0cf4d7c0c2d5b33bee63e5aca842cf8aa/68747470733a2f2f706f7365722e707567782e6f72672f73706972616c2f6f646d2f762f737461626c65)](https://packagist.org/packages/spiral/odm)[![License](https://camo.githubusercontent.com/371295899f5a851020d2b0aeda5fd632ae7de3c0f6e465aff2a3000f7b3d5cf9/68747470733a2f2f706f7365722e707567782e6f72672f73706972616c2f6f646d2f6c6963656e7365)](https://packagist.org/packages/spiral/odm)[![Build Status](https://camo.githubusercontent.com/47f5dfc8c6761c126ff0f644e490f65fdab13bc8f6bc7ad4ca9329d887e12793/68747470733a2f2f7472617669732d63692e6f72672f73706972616c2f6f646d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/spiral/odm)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/4968334e22beef5dac4e0abc2c4e4ee3730a3b420896d8d7facb48b06fb52768/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73706972616c2f6f646d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spiral/odm/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/d0161ba6ff0b0203dc1ea95a81fc56a8f4c2c786b2ba3dd44685b6412a486391/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73706972616c2f6f646d2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/spiral/odm?branch=master)

**[Full Documentation](http://spiral-framework.com/guide)** | [CHANGELOG](https://github.com/spiral/odm/blob/master/CHANGELOG.md)

LODM module is intended to bring the Spiral ODM component functionality into your Laravel applications. This component provides the ability to manage your MongoDB data in an OOP way using your models compositions and aggregations.

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

[](#installation)

Package installation can be performed using the simple composer command `$ composer require wolfy-j/lodm`.

To include ODM functionality in your application, you have to register the service provider `Spiral\LODM\Laravel\ODMServiceProvider` and CLI command `Spiral\LODM\Commands\SchemaUpdate` in the app.php configure and `ConsoleKernel` accordingly.

The module provides two configuration files which describe the class location directories (by default whole application), the set of connected MongoDB databases (ODM does not use any of Laravel's database functionality) and options that can simplify document creation.

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

[](#documentation)

- [MongoDB Databases](https://spiral-framework.com/guide/odm/databases.md)
- [Documents and DocumentEntity](https://spiral-framework.com/guide/odm/entities.md)
- [Accessors and Filters](https://spiral-framework.com/guide/odm/accessors.md)
- [Repositories and Selectors](https://spiral-framework.com/guide/odm/repositories.md)
- [Scaffolding](https://spiral-framework.com/guide/odm/scaffolding.md)
- [Compositions and Aggregations](https://spiral-framework.com/guide/odm/oop.md)
- [Inheritance](https://spiral-framework.com/guide/odm/inheritance.md)

Examples
--------

[](#examples)

```
class User extends Document
{
  const SCHEMA = [
    '_id'            => \MongoId::class,
    'name'           => 'string',
    'email'          => 'string',
    'balance'        => 'float',
    'timeRegistered' => \MongoDate::class,
    'tags'           => ['string'],
    'profile'        => Profile::class,

    //Aggregations
    'posts'          => [
        self::MANY => Post::class,
        ['userId' => 'self::_id']
    ]
  ];
}
```

```
protected function indexAction()
{
    $u = new User();
    $u->name = 'Anton';
    $u->email = 'test@email.com';
    $u->balance = 99;
    $u->save();

    dump($u);
}
```

```
protected function indexAction(string $id, UsersRepository $users)
{
    $user = $users->findByPK($id);
    if (empty($user)) {
        throw new NotFoundException('No such user');
    }

    dump($user);
}
```

```
$user = User::findOne();
$user->profile->biography = 'some bio';
$user->profile->facebookUID = 2345678;

$user->sessions->solidState(false);
$user->sessions->push(new Session([
    'timeCreated' => new \MongoDate(),
    'accessToken' => 'newrandom'
]));
```

Issues
------

[](#issues)

Please do not open issue tickets in this github project unless they are related to the integration process. Use [Primary Respository](https://github.com/spiral/odm) for ODM related issues.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 99.4% 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 ~59 days

Recently: every ~1 days

Total

11

Last Release

3211d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/796136?v=4)[Anton Tsitou](/maintainers/wolfy-j)[@wolfy-j](https://github.com/wolfy-j)

---

Top Contributors

[![wolfy-j](https://avatars.githubusercontent.com/u/796136?v=4)](https://github.com/wolfy-j "wolfy-j (178 commits)")[![Cutcaster](https://avatars.githubusercontent.com/u/853067?v=4)](https://github.com/Cutcaster "Cutcaster (1 commits)")

---

Tags

laravelmongodbodmphpspiral

### Embed Badge

![Health badge](/badges/wolfy-j-lodm/health.svg)

```
[![Health](https://phpackages.com/badges/wolfy-j-lodm/health.svg)](https://phpackages.com/packages/wolfy-j-lodm)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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