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

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

anhoder/swoft2-mongodb
======================

swoft2-mongodb component for swoft2 framework

0.1.4(5y ago)289MITPHP

Since Nov 21Pushed 5y agoCompare

[ Source](https://github.com/anhoder/swoft2-mongodb)[ Packagist](https://packagist.org/packages/anhoder/swoft2-mongodb)[ Docs](https://github.com/alanalbert/swoft2-mongodb)[ GitHub Sponsors](https://github.com/jenssegers)[ Fund](https://tidelift.com/funding/github/packagist/jenssegers/mongodb)[ RSS](/packages/anhoder-swoft2-mongodb/feed)WikiDiscussions master Synced today

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

Swoft2 MongoDB
==============

[](#swoft2-mongodb)

针对Swoft2，基于[jenssegers/laravel-mongodb](https://github.com/jenssegers/laravel-mongodb)进行改造的MongoDB包（不支持协程）。

- [Swoft2 MongoDB](#swoft2-mongodb)
    - [Installation](#installation)
    - [Configuration](#configuration)

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

[](#installation)

Make sure you have the MongoDB PHP driver installed. You can find installation instructions at

Install the package via Composer:

```
$ composer require anhoder/swoft2-mongodb
```

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

[](#configuration)

Add a new `mongodb` connection to `app/bean.php`:

```
return [
    // MongoDB
    'mongoDb'           => [
        'class'         => \Anhoder\Mongodb\Swoft\MongoDb::class,
        'host'          => '127.0.0.1',
        'port'          => 27017,
        'username'      => null,
        'password'      => null,
        'database'      => 'db1',
        'uriOptions'    => [],
        'driverOptions' => [],
    ],
    'mongodb.pool'      => [
        'class'       => \Anhoder\Mongodb\Swoft\MongoPool::class,
        'mongoDb'     => bean('mongoDb'),
        'minActive'   => 5,
        'maxActive'   => 10,
        'maxWait'     => 0,
        'maxWaitTime' => 0,
        'maxIdleTime' => 60,
    ],
];
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.8% 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 ~4 days

Total

5

Last Release

2033d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/27605589?v=4)[anhoder](/maintainers/anhoder)[@anhoder](https://github.com/anhoder)

---

Top Contributors

[![jenssegers](https://avatars.githubusercontent.com/u/194377?v=4)](https://github.com/jenssegers "jenssegers (672 commits)")[![Smolevich](https://avatars.githubusercontent.com/u/7188867?v=4)](https://github.com/Smolevich "Smolevich (95 commits)")[![divine](https://avatars.githubusercontent.com/u/48183131?v=4)](https://github.com/divine "divine (62 commits)")[![rennokki](https://avatars.githubusercontent.com/u/21983456?v=4)](https://github.com/rennokki "rennokki (27 commits)")[![anhoder](https://avatars.githubusercontent.com/u/27605589?v=4)](https://github.com/anhoder "anhoder (25 commits)")[![thilanga](https://avatars.githubusercontent.com/u/1523586?v=4)](https://github.com/thilanga "thilanga (25 commits)")[![pi0](https://avatars.githubusercontent.com/u/5158436?v=4)](https://github.com/pi0 "pi0 (24 commits)")[![duxet](https://avatars.githubusercontent.com/u/821707?v=4)](https://github.com/duxet "duxet (20 commits)")[![RemiCollin](https://avatars.githubusercontent.com/u/9589616?v=4)](https://github.com/RemiCollin "RemiCollin (17 commits)")[![denissonleal](https://avatars.githubusercontent.com/u/9142644?v=4)](https://github.com/denissonleal "denissonleal (16 commits)")[![alexandre-butynski](https://avatars.githubusercontent.com/u/671662?v=4)](https://github.com/alexandre-butynski "alexandre-butynski (14 commits)")[![Tucker-Eric](https://avatars.githubusercontent.com/u/6483755?v=4)](https://github.com/Tucker-Eric "Tucker-Eric (7 commits)")[![rjvandoesburg](https://avatars.githubusercontent.com/u/1488300?v=4)](https://github.com/rjvandoesburg "rjvandoesburg (7 commits)")[![simonschaufi](https://avatars.githubusercontent.com/u/941794?v=4)](https://github.com/simonschaufi "simonschaufi (7 commits)")[![Bodom78](https://avatars.githubusercontent.com/u/139152?v=4)](https://github.com/Bodom78 "Bodom78 (7 commits)")[![benargo](https://avatars.githubusercontent.com/u/863291?v=4)](https://github.com/benargo "benargo (7 commits)")[![Daveawb](https://avatars.githubusercontent.com/u/4409005?v=4)](https://github.com/Daveawb "Daveawb (6 commits)")[![stephandesouza](https://avatars.githubusercontent.com/u/159077?v=4)](https://github.com/stephandesouza "stephandesouza (6 commits)")[![DFurnes](https://avatars.githubusercontent.com/u/583202?v=4)](https://github.com/DFurnes "DFurnes (5 commits)")[![hlorofos](https://avatars.githubusercontent.com/u/5462396?v=4)](https://github.com/hlorofos "hlorofos (5 commits)")

---

Tags

mongodbswoft2swooleswoftswoft-component

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/octane

Supercharge your Laravel application's performance.

4.0k26.6M218](/packages/laravel-octane)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M94](/packages/mongodb-laravel-mongodb)[swoft/db

swoft database component

24169.3k11](/packages/swoft-db)[curtis18/swoft-pgsql

swoft postgresql component

101.1k1](/packages/curtis18-swoft-pgsql)

PHPackages © 2026

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