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

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

edsol/mongodb-cakephp
=====================

An Mongodb datasource for CakePHP 3.0

0118PHP

Since Jul 29Pushed 1y agoCompare

[ Source](https://github.com/Edsol/mongodb-cakephp3)[ Packagist](https://packagist.org/packages/edsol/mongodb-cakephp)[ RSS](/packages/edsol-mongodb-cakephp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

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

what's more
===========

[](#whats-more)

The fork fixes some bugs and adds the ability to be able to count rows in a collection:

```
$this->Categories->count($filters, $options);
```

---

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 Edsol/mongodb 1.0.0
```

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('Edsol/Mongodb');
```

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

[](#defining-a-connection)

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

```
 'Datasources' => [
    'default' => [
        'className' => 'Edsol\Mongodb\Database\Connection',
        'driver' => 'Edsol\Mongodb\Database\Driver\Mongodb',
        'persistent' => false,
        'host' => 'localhost',
        'port' => 27017,
        'srv' => false,
        'username' => '',
        '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 Edsol\\Mongodb\\ORM\\Table in your tables class:

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

use Edsol\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

18

—

LowBetter than 8% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1bb21d2eb71468f2e1714fe5557c4340f2b17b713c35d8876adb25ad80777aab?d=identicon)[EdsolXY](/maintainers/EdsolXY)

---

Top Contributors

[![tiaguinho](https://avatars.githubusercontent.com/u/961553?v=4)](https://github.com/tiaguinho "tiaguinho (24 commits)")[![ludeus](https://avatars.githubusercontent.com/u/7382872?v=4)](https://github.com/ludeus "ludeus (22 commits)")[![Edsol](https://avatars.githubusercontent.com/u/19670024?v=4)](https://github.com/Edsol "Edsol (10 commits)")[![delamux](https://avatars.githubusercontent.com/u/14236919?v=4)](https://github.com/delamux "delamux (8 commits)")[![issys16](https://avatars.githubusercontent.com/u/730772?v=4)](https://github.com/issys16 "issys16 (7 commits)")[![gig-shogo-ishikura](https://avatars.githubusercontent.com/u/107465543?v=4)](https://github.com/gig-shogo-ishikura "gig-shogo-ishikura (7 commits)")[![SocialITGit](https://avatars.githubusercontent.com/u/45766355?v=4)](https://github.com/SocialITGit "SocialITGit (4 commits)")[![kawaiidesune](https://avatars.githubusercontent.com/u/13595774?v=4)](https://github.com/kawaiidesune "kawaiidesune (3 commits)")[![kgws](https://avatars.githubusercontent.com/u/83611?v=4)](https://github.com/kgws "kgws (2 commits)")[![ignaciocarre](https://avatars.githubusercontent.com/u/358968?v=4)](https://github.com/ignaciocarre "ignaciocarre (2 commits)")[![johnjcamilleri](https://avatars.githubusercontent.com/u/376723?v=4)](https://github.com/johnjcamilleri "johnjcamilleri (1 commits)")[![abdelatnova](https://avatars.githubusercontent.com/u/37415353?v=4)](https://github.com/abdelatnova "abdelatnova (1 commits)")

### Embed Badge

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

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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