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

ActiveCakephp-plugin[Database &amp; ORM](/categories/database)

mofing/mongodb
==============

An Mongodb datasource for CakePHP 3.0

1.0.1(7y ago)08MITPHPPHP ^5.4|^7.0

Since Mar 11Pushed 7y ago1 watchersCompare

[ Source](https://github.com/wcj343169893/mongodb-cakephp3)[ Packagist](https://packagist.org/packages/mofing/mongodb)[ RSS](/packages/mofing-mongodb/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

[![Slack](https://camo.githubusercontent.com/5491c20e06cd4dbfe3d53f66e9214c7b321834b81e6e1fd3e0ebbfb06e27ff95/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e253230746865253230636f6e766572736174696f6e2d6f6e253230736c61636b2d677265656e2e737667)](https://mongodb-cakephp3.slack.com/messages/general/)

Mongodb for Cakephp3
====================

[](#mongodb-for-cakephp3)

An Mongodb datasource for CakePHP 3.5

Installing via composer
-----------------------

[](#installing-via-composer)

Install [composer](http://getcomposer.org) and run:

```
composer require mofing/mongodb
```

Connecting the Plugin to your application
-----------------------------------------

[](#connecting-the-plugin-to-your-application)

add the following line in your config/bootstrap.php to tell your application to load the plugin:

```
Plugin::load('Mofing/Mongodb');
```

Defining a connection
---------------------

[](#defining-a-connection)

Now, you need to set the connection in your config/app.php file:

```
 'Datasources' => [
    'default' => [
        'className' => 'Mofing\Mongodb\Database\Connection',
        'driver' => 'Mofing\Mongodb\Database\Driver\Mongodb',
        'persistent' => false,
        'host' => 'localhost',
        'port' => 27017,
        'login' => '',
        'password' => '',
        'database' => 'devmongo',
        'ssh_host' => '',
        'ssh_port' => 22,
        'ssh_user' => '',
        'ssh_password' => '',
        'ssh_pubkey_path' => '',
        'ssh_privatekey_path' => '',
        'ssh_pubkey_passphrase' => ''
    ],
],
```

### SSH tunnel variables (starting with 'ssh\_')

[](#ssh-tunnel-variables-starting-with-ssh_)

If you want to connect to MongoDB using a SSH tunnel, you need to set additional variables in your Datasource. Some variables are unnecessary, depending on how you intend to connect. IF you're connecting using a SSH key file, the `ssh_pubkey_path` and `ssh_privatekey_path` variables are necessary and the `ssh_password` variable is unnecessary. If you're connecting using a text-based password (which is **not** a wise idea), the reverse is true. The function needs, at minimum, `ssh_host`, `ssh_user` and one method of authentication to establish a SSH tunnel.

Models
------

[](#models)

After that, you need to load Hayko\\Mongodb\\ORM\\Table in your tables class:

```
//src/Model/Table/YourTable.php

use Mofing\Mongodb\ORM\Table;

class CategoriesTable extends Table {

}
```

Observations
------------

[](#observations)

The function find() works only in the old fashion way. So, if you want to find something, you to do like the example:

```
$this->Categories->find('all', ['conditions' => ['name' => 'teste']]);
$this->Categories->find('all', ['conditions' => ['name LIKE' => 'teste']]);
$this->Categories->find('all', ['conditions' => ['name' => 'teste'], 'limit' => 3]);
```

You can also use the advanced conditions of MongoDB using the `MongoDB\BSON` namespace

```
$this->Categories->find('all', ['conditions' => [
    '_id' => new \MongoDB\BSON\ObjectId('5a7861909db0b47d605c3865'),
    'foo.bar' => new \MongoDB\BSON\Regex('^(foo|bar)?baz$', 'i')
]]);
```

LICENSE
-------

[](#license)

[The MIT License (MIT) Copyright (c) 2013](http://opensource.org/licenses/MIT)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

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

Total

2

Last Release

2621d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ba50770ab3b983b6876cc5d96fb7915f8f1ff6efeb560de643d7c6948aa8f56?d=identicon)[wcj343169893](/maintainers/wcj343169893)

---

Top Contributors

[![ludeus](https://avatars.githubusercontent.com/u/7382872?v=4)](https://github.com/ludeus "ludeus (22 commits)")[![tiaguinho](https://avatars.githubusercontent.com/u/961553?v=4)](https://github.com/tiaguinho "tiaguinho (19 commits)")[![wcj343169893](https://avatars.githubusercontent.com/u/502789?v=4)](https://github.com/wcj343169893 "wcj343169893 (4 commits)")[![kawaiidesune](https://avatars.githubusercontent.com/u/13595774?v=4)](https://github.com/kawaiidesune "kawaiidesune (3 commits)")[![ignaciocarre](https://avatars.githubusercontent.com/u/358968?v=4)](https://github.com/ignaciocarre "ignaciocarre (2 commits)")[![abdelatnova](https://avatars.githubusercontent.com/u/37415353?v=4)](https://github.com/abdelatnova "abdelatnova (1 commits)")[![gig-shogo-ishikura](https://avatars.githubusercontent.com/u/107465543?v=4)](https://github.com/gig-shogo-ishikura "gig-shogo-ishikura (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k23.3M302](/packages/doctrine-mongodb-odm)[alcaeus/mongo-php-adapter

Adapter to provide ext-mongo interface on top of mongo-php-library

46412.3M73](/packages/alcaeus-mongo-php-adapter)[dereuromark/cakephp-databaselog

A CakePHP plugin for storing and viewing application logs in the database

44165.0k2](/packages/dereuromark-cakephp-databaselog)[pgbi/cakephp3-soft-delete

SoftDelete plugin for CakePHP

87291.9k](/packages/pgbi-cakephp3-soft-delete)[moloquent/moloquent

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)

120114.6k7](/packages/moloquent-moloquent)

PHPackages © 2026

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