anhoder / swoft2-mongodb
swoft2-mongodb component for swoft2 framework
Fund package maintenance!
jenssegers
Tidelift
Requires
- ext-json: *
- ext-mongodb: *
- mongodb/mongodb: ^1.6
- nesbot/carbon: ^2.41
- swoft/db: ^2.0
- swoft/framework: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.4
This package is auto-updated.
Last update: 2024-12-20 19:51:11 UTC
README
针对Swoft2,基于jenssegers/laravel-mongodb进行改造的MongoDB包(不支持协程)。
Installation
Make sure you have the MongoDB PHP driver installed. You can find installation instructions at http://php.net/manual/en/mongodb.installation.php
Install the package via Composer:
$ composer require anhoder/swoft2-mongodb
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, ], ];