PHPackages                             exs/silex-simplemongo-provider - 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. exs/silex-simplemongo-provider

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

exs/silex-simplemongo-provider
==============================

Simple mongdb provider for Silex2

v1.0.0(9y ago)022MITPHPPHP &gt;=7.0

Since Oct 11Pushed 9y ago9 watchersCompare

[ Source](https://github.com/ExSituMarketing/EXS-silex-simplemongo-provider)[ Packagist](https://packagist.org/packages/exs/silex-simplemongo-provider)[ Docs](https://github.com/ExSituMarketing/EXS-silex-simplemongo-provider)[ RSS](/packages/exs-silex-simplemongo-provider/feed)WikiDiscussions master Synced 2mo ago

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

EXS-silex-simplemongo-provider
==============================

[](#exs-silex-simplemongo-provider)

A simple Silex provider to persist and execute queries on MongDB database on php7

Installing the EXS-silex-simplemongo-provider in a Silex project
----------------------------------------------------------------

[](#installing-the-exs-silex-simplemongo-provider-in-a-silex-project)

Open the composer.json file and add the EXS-silex-simplemongo-provider as a dependency:

```
//composer.json
//...
"require": {
        //other bundles
        "exs/silex-simplemongo-provider": "^1.0"
```

Save the file and have composer update the project via the command line:

```
php composer.phar install
```

Or you could just add it via the command line:

```
$ composer.phar require exs/silex-simplemongo-provider

```

Update the app.php to include EXS-silex-simplemongo-provider:

```
//app.php
//...
$app->register(new \EXS\SimpleMongoProvider\Providers\Services\SimpleMongoProvider());
```

Update your mongodb connection and environment in your config.php:

```
//...
$app['mongo.connections'] = array(
    'connection' => 'mongodb://localhost:27017',
    'dbname' => 'DB_NAME'
);
//...
```

USAGE
-----

[](#usage)

Register the service in your service provider

```
    public function register(Container $container)
    {
        $container[YOUR_SERVICE_NAME] = ( function ($container) {
            return new YOUR_SERVICE(
                $container['exs.serv.mongo']
                );
        });
    }
```

In your service

```
public function __construct(\EXS\SimpleMongoProvider\Services\SimpleMongoService $mongo_service)
{
    $this->mongo_service = $mongo_service;
}
.
.
.

// Insert
$this->mongo_service->persist(YOUR_CLASS_OR_ARRAY);
$result = $this->mongo_service->flush(COLLECTION_NAME); // the result will store the number of inserted entries or error message
if(!is_int($result) || $result == 0) {
    throwException($result);
}

// Update
$filter = ['product' => 6];
$this->mongo_service->update($filter, YOUR_CLASS_OR_ARRAY);
$result = $this->mongo_service->flush(COLLECTION_NAME);

// Get data with query
$filter = ['product' => 6];
$option = ['projection' => ['_id' => 0]];

$result = $$this->mongo_service->exeQuery($filter, $option, COLLECTION_NAME);
// $result will contain results in an array
```

#### Contributing

[](#contributing)

Anyone and everyone is welcome to contribute.

If you have any questions or suggestions please [let us know](http://www.ex-situ.com/).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

3497d ago

Major Versions

v0.0.1 → v1.0.02016-10-12

### Community

Maintainers

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

---

Top Contributors

[![slee1803](https://avatars.githubusercontent.com/u/10144066?v=4)](https://github.com/slee1803 "slee1803 (3 commits)")

---

Tags

providermongodbsilex

### Embed Badge

![Health badge](/badges/exs-silex-simplemongo-provider/health.svg)

```
[![Health](https://phpackages.com/badges/exs-silex-simplemongo-provider/health.svg)](https://phpackages.com/packages/exs-silex-simplemongo-provider)
```

###  Alternatives

[moriony/silex-mongo-provider

Mongo service provider for the Silex framwork.

118.5k](/packages/moriony-silex-mongo-provider)[dbtlr/silex-doctrine-migrations

Doctrine migration service provider for Silex

1123.8k1](/packages/dbtlr-silex-doctrine-migrations)

PHPackages © 2026

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