PHPackages                             flatline/mongol - 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. flatline/mongol

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

flatline/mongol
===============

MongoDB library and Auth driver for Laravel 4

0.1.2(13y ago)238MITPHPPHP &gt;=5.3.0

Since Jan 15Pushed 13y ago1 watchersCompare

[ Source](https://github.com/Cosmicist/mongol)[ Packagist](https://packagist.org/packages/flatline/mongol)[ Docs](http://github.com/xFlatlinex/laravel-mongol)[ RSS](/packages/flatline-mongol/feed)WikiDiscussions master Synced 1mo ago

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

laravel-mongol
==============

[](#laravel-mongol)

MongoDB library and Auth driver for Laravel 4.

It extends PHP's [MongoDB Native Driver](http://php.net/mongo).

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

[](#installation)

Require `flatline/mongol` in your project's `composer.json`:

```
{
    "require": {
        "flatline/mongol": "0.1.*"
    }
}
```

Update or install your packages with `composer update` or `composer install` respectively.

Now you need to register MongolServiceProvider with Laravel.
Open up `app/config/app.php` and add the following to the `providers` key:

```
'Flatline\Mongol\MongolServiceProvider'
```

You can also register the facade in the class aliases, look for the `aliases` key and add the following:

```
'Mongol' => 'Flatline\Mongol\Mongol'
```

This way you can use `Mongol::connection()` instead of `Flatline\Mongol\Mongol::connection()`.

Configuration
-------------

[](#configuration)

In order to use your own database credentials you can extend the package configuration by creating `app/config/packages/flatline/mongol/config.php`.

You can do this by running the following Artisan command.

```
$ php artisan config:publish flatline/mongol

```

Here's an example configuration using mongohq

```
'default' => array(
    'host'     => 'alex.mongohq.com',
    'port'     => 10002,
    'username' => 'your_username',
    'password' => 'your_db_password',
    'database' => 'your_db_name',
),
```

You can also connect as admin

```
'other_credentials' => array(
    'host'     => 'localhost',
    'username' => 'your_admin_username',
    'password' => 'your_admin_db_password',
    'database' => 'your_db_name',
    'admin'    => true,
),
```

You can create as many database credential groups as you need.

Auth Driver configuration
-------------------------

[](#auth-driver-configuration)

To use Mongol with the Auth library, just set 'mongol' as the driver in `app/config/auth.php`:

```
'driver' => 'mongol'
```

Usage
-----

[](#usage)

You use it the same way you would use the native driver, but first you need to get the connection and database.

To get your default connection use:

```
Mongol::connection();
```

To get other connection:

```
Mongol::connection('group');
```

To get the database just use:

```
Mongol::connection()->getDB();
```

And to get other db using the same credentials (you must be authenticated as admin), you can use:

```
Mongol::connection()->getDB('other_db_name')
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Total

3

Last Release

4856d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/019c54e641913619a9ac66163a02515fa8187062c7128d877903cbc4acfd5391?d=identicon)[Cosmicist](/maintainers/Cosmicist)

---

Top Contributors

[![Cosmicist](https://avatars.githubusercontent.com/u/1039580?v=4)](https://github.com/Cosmicist "Cosmicist (1 commits)")

---

Tags

laravelauthmongodbdrivermongo

### Embed Badge

![Health badge](/badges/flatline-mongol/health.svg)

```
[![Health](https://phpackages.com/badges/flatline-mongol/health.svg)](https://phpackages.com/packages/flatline-mongol)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[jenssegers/mongodb-session

A MongoDB session driver for Laravel 4, 5, 6, 7 and 8

76308.1k3](/packages/jenssegers-mongodb-session)[leroy-merlin-br/mongolid

Easy, powerful and ultrafast ODM for PHP and MongoDB.

11234.3k4](/packages/leroy-merlin-br-mongolid)[julien-c/mongovel

A Laravel-ish wrapper to the PHP Mongo driver

357.7k](/packages/julien-c-mongovel)[jenssegers/mongodb-lite

A lightweight MongoDB database library and model for Laravel 4

111.0k](/packages/jenssegers-mongodb-lite)

PHPackages © 2026

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