PHPackages                             nasustop/hapi-mongo - 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. nasustop/hapi-mongo

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

nasustop/hapi-mongo
===================

1.0.0(3y ago)05MITPHPPHP &gt;=8.0

Since Apr 4Pushed 3y ago1 watchersCompare

[ Source](https://github.com/nasustop/hapi-mongo)[ Packagist](https://packagist.org/packages/nasustop/hapi-mongo)[ RSS](/packages/nasustop-hapi-mongo/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (9)Versions (2)Used By (0)

HapiMongo
=========

[](#hapimongo)

hyperf的mongo协程组件

现阶段 Swoole 暂时没有办法 hook 所有的阻塞函数，也就意味着有些函数仍然会导致 进程阻塞，从而影响协程的调度 因为 MongoDB 没有办法被 hook，所以当前项目会阻塞进程，请谨慎使用 参考文档:

生产环境使用mongo请参考[hapi-sidecar](https://github.com/nasustop/hapi-sidecar)边车服务

安装
--

[](#安装)

```
composer require nasustop/hapi-mongo
```

声称配置文件
------

[](#声称配置文件)

```
php bin/hyperf.php vendor:publish nasustop/hapi-mongo
```

添加索引
----

[](#添加索引)

```
mongo()->cmd([
    // 集合名
    'createIndexes' => 'api_log',
    'indexes' => [
        [
            // 索引名
            'name' => 'msg_code_index',
            // 索引字段数组[1升序，-1降序]
            'key' => ['msg_code' => 1],
        ],
    ],
]);
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Unknown

Total

1

Last Release

1186d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/04611b4e26e4080a8441f8274c59331b0e3e858a0d836ed7c4a29dcf4a49ee93?d=identicon)[antsgo](/maintainers/antsgo)

---

Top Contributors

[![eaglexpf](https://avatars.githubusercontent.com/u/16461274?v=4)](https://github.com/eaglexpf "eaglexpf (2 commits)")

---

Tags

phphyperf

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nasustop-hapi-mongo/health.svg)

```
[![Health](https://phpackages.com/badges/nasustop-hapi-mongo/health.svg)](https://phpackages.com/packages/nasustop-hapi-mongo)
```

###  Alternatives

[hyperf/database

A flexible database library.

192.9M319](/packages/hyperf-database)[hyperf/amqp

A amqplib for hyperf.

231.3M71](/packages/hyperf-amqp)[hyperf/http-server

A HTTP Server for Hyperf.

103.0M368](/packages/hyperf-http-server)[hyperf/socketio-server

Socket.io implementation for hyperf

26140.9k7](/packages/hyperf-socketio-server)[hyperf/graphql

A GraphQL component for hyperf.

151.5k](/packages/hyperf-graphql)

PHPackages © 2026

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