PHPackages                             mawelous/yamop-laravel - 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. mawelous/yamop-laravel

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

mawelous/yamop-laravel
======================

Yet another MongoDB ODM for PHP as Laravel Component. Nothing unnecessary, with easy joins.

0.2.0(12y ago)81561MITPHPPHP &gt;=5.3.0

Since Sep 3Pushed 10y ago7 watchersCompare

[ Source](https://github.com/mawelous/yamop-laravel)[ Packagist](https://packagist.org/packages/mawelous/yamop-laravel)[ Docs](https://github.com/mawelous/yamop-laravel)[ RSS](/packages/mawelous-yamop-laravel/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

Yamop for Laravel
=================

[](#yamop-for-laravel)

### Yet another MongoDB ODM for PHP as Laravel Component

[](#yet-another-mongodb-odm-for-php-as-laravel-component)

- [What's that?](#whatsthat)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Pagination](#pagination)
- [Authentication](#authentication)
- [Issues](#Issues)
- [License](#license)

What's that?
------------

[](#whats-that)

This is yet another, open source, and very simple [MongoDB](http://www.mongodb.org/) ODM for [Laravel 4](http://www.laravel.com/). It works like the standard MongoDB PHP extension interface but returns objects instead of arrays (as ODM). Queries stay the same. One of its coolest features are joins which allow you to query for related objects. This version for Laravel is based on [Yamop](https://github.com/mawelous/yamop) which can be included into any PHP project. In addition to the standard features it supports Laravel based authentication.

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

[](#requirements)

- PHP 5.3+
- PHP MongoDB Extension
- Laravel 4

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

[](#installation)

You can simply download it [here](https://github.com/mawelous/yamop-laravel) or use [Composer](http://getcomposer.org/).

In the `require` key inside the `composer.json` file add the following

```
    "mawelous/yamop-laravel": "dev-master"
```

Save it and run the Composer update command

```
$ composer update

```

After this is done, add `mongo` in your database configuration:

```
    'mongo' => array(
        'host'     => 'host',
        'port'     => 37847,
        'database' => 'db',
        'user'     => 'user',
        'password' => 'pass'
    ),
```

Now we need to let Laravel know about this new service provider. To do so add under `providers` in the `config\app.php` file the following:

```
    ...
    'Illuminate\View\ViewServiceProvider',
    'Illuminate\Workbench\WorkbenchServiceProvider',
    ...
    'Mawelous\YamopLaravel\YamopLaravelServiceProvider',
```

Aliases to the Yamop classes are useful. Add them in the `aliases` array in the `config\app.php` file:

```
    ...
    'Validator'       => 'Illuminate\Support\Facades\Validator',
    'View'            => 'Illuminate\Support\Facades\View',
    ...
    'Mapper'          => 'Mawelous\YamopLaravel\Mapper',
    'Model'           => 'Mawelous\YamopLaravel\Model',
```

To use Yamop you now just need to extend the Yamop alias `Model` from within any of your new or existing models:

```
    class Article extends Model
    {
        protected static $_collectionName = 'articles';
    }
```

That's it!

Usage
-----

[](#usage)

For usage examples and further explanation take a look at the [Yamop Documentation](https://github.com/mawelous/yamop#usage). In this release for Laravel you can also use aliases for `Mapper` and `Model` which were registered during installation. See the following pagination example.

Pagination
----------

[](#pagination)

Yamop for Laravel supports pagination out of the box. It implements the `_createPaginator` method and extends `getPaginator`, with this you only need to pass the items per page into the method. The second parameter which is the current page number, and the third which is the page parameter name are both optional.

```
    User::getMapper()
        ->find( 'status' => [ '$ne' => User::STATUS_DELETED ] ) )
        ->sort( [ $field => $direction ] )
        ->getPaginator( $perPage );

    //or
    User::getMapper()
        ->find()
        ->getPaginator( $perPage, $currentPage, 'commentsPage' );
```

Authentication
--------------

[](#authentication)

Laravel's package of Yamop supports native like authentication. You must first extend your `User` Model with Yamop's `Mawelous\YampoLaravel\User`

```
    class User extends Mawelous\YamopLaravel\User
    {
        protected static $_collectionName = 'users';
    }
```

In `auth\config.php` change the driver to `yamop`.

```
    ...
    'driver' => 'yamop',
    ...
```

Now you can implement it as standard authentication:

```
    class AuthController extends BaseController {

        public function getLogin()
        {
            return View::make( 'auth.login' );
        }

        public function postLogin()
        {
            if( Auth::attempt( [ 'nickname' => Input::get( 'nickname' ), 'password' => input::get( 'password' ) ] ) )
            {
                return Redirect::intended( 'dashboard' );
            } else {
                return Redirect::to( '/login' )->with( 'login_failed', true );
            }
        }
    }
```

Issues
------

[](#issues)

Any issues or questions please [report here](https://github.com/Mawelous/yamop-laravel/issues)

License
-------

[](#license)

Yamop is free software distributed under the terms of the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

4

Last Release

4549d ago

### Community

Maintainers

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

---

Top Contributors

[![kamil-zielinski](https://avatars.githubusercontent.com/u/2385518?v=4)](https://github.com/kamil-zielinski "kamil-zielinski (3 commits)")[![tobsn](https://avatars.githubusercontent.com/u/109529?v=4)](https://github.com/tobsn "tobsn (3 commits)")[![impiix](https://avatars.githubusercontent.com/u/8666315?v=4)](https://github.com/impiix "impiix (1 commits)")

---

Tags

phplaravelodmmongodbmongoobject document mapper

### Embed Badge

![Health badge](/badges/mawelous-yamop-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/mawelous-yamop-laravel/health.svg)](https://phpackages.com/packages/mawelous-yamop-laravel)
```

###  Alternatives

[leroy-merlin-br/mongolid

Easy, powerful and ultrafast ODM for PHP and MongoDB.

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

Easy, powerful and ultrafast MongoDB ODM for Laravel.

23827.8k2](/packages/leroy-merlin-br-mongolid-laravel)[denchikby/phalcon-mongodb-odm

Phalcon MongoDB ODM

4212.8k](/packages/denchikby-phalcon-mongodb-odm)

PHPackages © 2026

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