PHPackages                             hobord/mongodb - 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. hobord/mongodb

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

hobord/mongodb
==============

MongoDb database connection and model

03PHP

Since Oct 5Pushed 9y ago1 watchersCompare

[ Source](https://github.com/hobord/laravel-mongodb)[ Packagist](https://packagist.org/packages/hobord/mongodb)[ RSS](/packages/hobord-mongodb/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

laravel-mongodb
===============

[](#laravel-mongodb)

And add the service provider in config/app.php:

Hobord\\MongoDb\\MongodbServiceProvider::class,

\##Configuration And add a new mongodb connection:

```
'mongodb' => [
    'driver'   => 'mongodb',
    'host'     => env('MONGO_DB_HOST', 'localhost'),
    'port'     => env('MONGO_DB_PORT', 27017),
    'database' => env('MONGO_DB_DATABASE'),
    'username' => env('MONGO_DB_USERNAME'),
    'password' => env('MONGO_DB_PASSWORD'),
    'options' => [
        'database' => 'admin' // sets the authentication database required by mongo 3
    ]
],

```

You can connect to multiple servers or replica sets with the following configuration:

```
'mongodb' => [
    'driver'   => 'mongodb',
    'host'     => ['server1', 'server2'],
    'port'     => env('MONGO_DB_PORT', 27017),
    'database' => env('MONGO_DB_DATABASE'),
    'username' => env('MONGO_DB_USERNAME'),
    'password' => env('MONGO_DB_PASSWORD'),
    'options'  => ['replicaSet' => 'replicaSetName']
],

```

\##Example usage

```
namespace App;
use Hobord\MongoDb\Model\Model;

class TestModel extends Model
{
    protected $table = "test_collection";

    protected $schema = [
        'pricing' => 'App\PricingField'
    ];
}

#####

namespace App;

use Hobord\MongoDb\Model\Field;

class PricingField extends Field
{

}

#####

TestModel::create([
    'sku'=> '00e8da9c',
    'pricing' => [
        'list' => 500,
        'retail' => 600,
        'action' => 700
    ]
]);

$test = TestModel::where('sku', '00e8da9c')->first();
$test->pricing->retail = 999;
$test->karma = "ok";
$test->save();

$test = TestModel::where('pricing.retail', '>', 600)->skip(1)->take(1)->get();

```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.2% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/21d3b2f833259f4973218a372496187587b770415d19f829ed9bf96086f998f4?d=identicon)[hobord](/maintainers/hobord)

---

Top Contributors

[![888balazs](https://avatars.githubusercontent.com/u/32355517?v=4)](https://github.com/888balazs "888balazs (30 commits)")[![hobord](https://avatars.githubusercontent.com/u/203969?v=4)](https://github.com/hobord "hobord (11 commits)")

### Embed Badge

![Health badge](/badges/hobord-mongodb/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198628.3k10](/packages/pgvector-pgvector)

PHPackages © 2026

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