{"id":18353193,"url":"https://github.com/reasno/fastmongo","last_synced_at":"2025-04-06T10:11:22.717Z","repository":{"id":44794565,"uuid":"268456082","full_name":"Reasno/fastmongo","owner":"Reasno","description":"🔌  Plug \u0026 Play Mongodb driver for Hyperf (With Coroutine!)","archived":false,"fork":false,"pushed_at":"2024-08-20T17:23:45.000Z","size":62620,"stargazers_count":87,"open_issues_count":17,"forks_count":17,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T08:09:18.580Z","etag":null,"topics":["coroutine","hyperf","hyperf-mongodb","mongodb","swoole"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Reasno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-01T07:39:34.000Z","updated_at":"2025-03-14T08:04:03.000Z","dependencies_parsed_at":"2024-06-12T13:16:31.672Z","dependency_job_id":"199fa7fc-6b26-4034-97ac-862825d25574","html_url":"https://github.com/Reasno/fastmongo","commit_stats":{"total_commits":33,"total_committers":3,"mean_commits":11.0,"dds":0.06060606060606055,"last_synced_commit":"309412af9f4f7b100dd0d88cffa7ebaf0e37b4e1"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reasno%2Ffastmongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reasno%2Ffastmongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reasno%2Ffastmongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reasno%2Ffastmongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Reasno","download_url":"https://codeload.github.com/Reasno/fastmongo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247464222,"owners_count":20942970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coroutine","hyperf","hyperf-mongodb","mongodb","swoole"],"created_at":"2024-11-05T21:38:49.598Z","updated_at":"2025-04-06T10:11:22.694Z","avatar_url":"https://github.com/Reasno.png","language":"PHP","readme":"`reasno/fastmongo` is the a coroutine-based mongodb client for Hyperf, powered by `hyperf/gotask`.\n\n## Installation\n\n```php\ncomposer require reasno/fastmongo\n```\n- MongoDB extension is required. \n- MongoDB \u003e 4.0\n- MongoDB PHP library is ***NOT*** required.\n- Go is ***NOT*** required.\n\n## Configuration\n\nJust set the environmental variable MONGODB_URI. (Defaults to `mongodb://127.0.0.1:27017`)\n\nYou may also use `php bin/hyperf.php vendor:publish reasno/fastmongo` to export a configuration.\n\n## API List\n\n```php\n\u003c?php\nnamespace App\\Controller;\n\nuse Hyperf\\GoTask\\MongoClient\\MongoClient;\n\nclass IndexController\n{\n    public function index(MongoClient $client)\n    {\n        $col = $client-\u003emy_database-\u003emy_col;\n        $col-\u003einsertOne(['gender' =\u003e 'male', 'age' =\u003e 18]);\n        $col-\u003einsertMany([['gender' =\u003e 'male', 'age' =\u003e 20], ['gender' =\u003e 'female', 'age' =\u003e 18]]);\n        $col-\u003ecountDocuments();\n        $col-\u003efindOne(['gender' =\u003e 'male']);\n        $col-\u003efind(['gender' =\u003e 'male'], ['skip' =\u003e 1, 'limit' =\u003e 1]);\n        $col-\u003eupdateOne(['gender' =\u003e 'male'], ['$inc' =\u003e ['age' =\u003e 1]]);\n        $col-\u003eupdateMany(['gender' =\u003e 'male'], ['$inc' =\u003e ['age' =\u003e 1]]);\n        $col-\u003ereplaceOne(['gender' =\u003e 'female'], ['gender' =\u003e 'female', 'age' =\u003e 15]);\n        $col-\u003eaggregate([\n              ['$match' =\u003e ['gender' =\u003e 'male']],\n              ['$group' =\u003e ['_id' =\u003e '$gender', 'total' =\u003e ['$sum' =\u003e '$age']]],\n        ]);\n        $col-\u003edeleteOne(['gender' =\u003e 'male']);\n        $col-\u003edeleteMany(['age' =\u003e 15]);\n        $col-\u003edrop();\n        // if there is a command not yet supported, use runCommand or runCommandCursor.\n        $client-\u003emy_database-\u003erunCommand(['ping' =\u003e 1]);\n        return $client-\u003emy_database-\u003erunCommandCursor(['listCollections' =\u003e 1]); \n    }\n}\n```\n\n## Background\n\nThis package makes use of `hyperf/gotask` to achieve coroutine.\n\nIn `hyperf/gotask` v2.1.0 a new mongodb package is added. Normally GoTask requires you to do some coding in Go. However this approach demands some proficiency in Go, which can be prohibitive. `reasno/fastmongo` is a prebuilt version of the newly added mongodb package. It vendors the Go binary for you so you don't have to compile your own.\n\nThis package only exposes a very simple yet optimized configuration interface. Should more customization be needed, checkout out the original `hyperf/gotask`. \n\n\u003e Please do not turn on `hyperf/gotask` and this package at the same time.\n\n## Future Scope\n* More mongodb commands can be added. Please feel free to create issues or submit your PRs to `hyperf/gotask`.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freasno%2Ffastmongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freasno%2Ffastmongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freasno%2Ffastmongo/lists"}