New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

wolfy-j/lodm

Laravel ODM module using Spiral ODM component.
1,855 21

Larablocks Analysis

wolfy-j/lodm works with any PHP project: the latest release (v0.9.6, Aug 2, 2017) doesn't depend on Laravel.

Laravel 4 and 5 in earlier releases.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • No release in the last 12 months (last: Aug 2, 2017)
  • 0 downloads a month (needs 10,000)
  • 21 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Aug 2, 2017.
  • No releases in the last 12 months.
  • First released: Dec 15, 2015.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 28, 2026.

Install
composer require wolfy-j/lodm
Latest Version:v0.9.6
Older releases:4 · 5
Last Updated:Aug 2, 2017
Links: GitHub  ·  Packagist
Maintainer: wolfy-j

ODM with inheritance and OOP composition for Laravel 5+

Latest Stable Version License Build Status Scrutinizer Code Quality Coverage Status

Full Documentation | CHANGELOG

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

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

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

Please do not open issue tickets in this github project unless they are related to the integration process. Use Primary Respository for ODM related issues.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released Laravel License
v0.9.6
v0.9.5
v0.9.4
v0.9.3
v0.9.2