{"id":13530341,"url":"https://github.com/alcaeus/mongo-php-adapter","last_synced_at":"2025-11-11T20:54:27.168Z","repository":{"id":45064480,"uuid":"48753194","full_name":"alcaeus/mongo-php-adapter","owner":"alcaeus","description":":link: Adapter to provide ext-mongo interface on top of mongo-php-library","archived":false,"fork":false,"pushed_at":"2024-03-25T03:03:07.000Z","size":772,"stargazers_count":463,"open_issues_count":3,"forks_count":125,"subscribers_count":24,"default_branch":"1.x","last_synced_at":"2024-10-29T15:48:33.760Z","etag":null,"topics":["adapter","mongodb"],"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/alcaeus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG-1.0.md","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}},"created_at":"2015-12-29T15:16:38.000Z","updated_at":"2024-09-29T21:46:03.000Z","dependencies_parsed_at":"2023-01-22T11:15:10.142Z","dependency_job_id":"b5f947a3-a399-4e9d-b2a2-3aa5558be8d2","html_url":"https://github.com/alcaeus/mongo-php-adapter","commit_stats":{"total_commits":343,"total_committers":31,"mean_commits":"11.064516129032258","dds":0.2011661807580175,"last_synced_commit":"248d60e15c9388652fb986489dac80d1bbb78d55"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alcaeus%2Fmongo-php-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alcaeus%2Fmongo-php-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alcaeus%2Fmongo-php-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alcaeus%2Fmongo-php-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alcaeus","download_url":"https://codeload.github.com/alcaeus/mongo-php-adapter/tar.gz/refs/heads/1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248784963,"owners_count":21161208,"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":["adapter","mongodb"],"created_at":"2024-08-01T07:00:48.410Z","updated_at":"2025-11-11T20:54:27.129Z","avatar_url":"https://github.com/alcaeus.png","language":"PHP","funding_links":[],"categories":["Libraries","PHP"],"sub_categories":["PHP"],"readme":"# Mongo PHP Adapter\n\n[![Build Status](https://travis-ci.org/alcaeus/mongo-php-adapter.svg?branch=master)](https://travis-ci.org/alcaeus/mongo-php-adapter)\n[![Code Coverage](https://scrutinizer-ci.com/g/alcaeus/mongo-php-adapter/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/alcaeus/mongo-php-adapter/?branch=master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/alcaeus/mongo-php-adapter/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/alcaeus/mongo-php-adapter/?branch=master)\n\nThe Mongo PHP Adapter is a userland library designed to act as an adapter\nbetween applications relying on ext-mongo and the new driver (`ext-mongodb`).\n\nIt provides the API of ext-mongo built on top of mongo-php-library, thus being\ncompatible with PHP 7.\n\n# Goal\n\nThis library aims to provide a compatibility layer for applications that rely on\nlibraries using ext-mongo, e.g.\n[Doctrine MongoDB ODM](https://github.com/doctrine/mongodb-odm), but want to\nmigrate to PHP 7 on which `ext-mongo` will not run.\n\nYou should not be using this library if you do not rely on a library using\n`ext-mongo`. If you are starting a new project, please check out\n[mongodb/mongodb](https://github.com/mongodb/mongo-php-library).\n\n# Installation\n\nThis library requires you to have the `mongodb` extension installed, and it\nconflicts with the legacy `mongo` extension.\n\nThe preferred method of installing this library is with\n[Composer](https://getcomposer.org/) by running the following from your project\nroot:\n\n    $ composer config \"platform.ext-mongo\" \"1.6.16\" \u0026\u0026 composer require alcaeus/mongo-php-adapter\n\nThe above command first marks the `mongo` extension as installed, then requires\nthis adapter. This is to work around a bug in composer, see\n[composer/composer#5030](https://github.com/composer/composer/issues/5030).\n\n# Known issues\n\n## Return values and exceptions\n\nSome methods may not throw exceptions with the same exception messages as their\ncounterparts in `ext-mongo`. Do not rely on exception messages being the same.\n\nMethods that return a result array containing a `connectionId` field will always\nreturn `0` as connection ID.\n\n## Errors\n\nAll errors and warnings triggered by `ext-mongo` are triggered as `E_USER_WARNING`\nand `E_USER_ERROR` because `trigger_error` doesn't accept the `E_WARNING` and\n`E_USER` codes. If you rely on these error codes in your error handling routines,\nplease update your code accordingly.\n\n## Serialization of objects\nSerialization of any Mongo* objects (e.g. MongoGridFSFile, MongoCursor, etc.)\nwill not work properly. The objects can be serialized but are not usable after\nunserializing them.\n\n## Mongo\n\n - The Mongo class is deprecated and was not implemented in this library. If you\n are still using it please update your code to use the new classes.\n\n## MongoLog\n\n - The [MongoLog](http://php.net/manual/en/class.mongolog.php) class does not\n log anything because the underlying driver does not offer a method to retrieve\n this data.\n\n## MongoClient\n\n - The [connect](https://php.net/manual/en/mongoclient.connect.php) and\n [close](https://secure.php.net/manual/en/mongoclient.close.php) methods are not\n implemented because the underlying driver connects lazily and does not offer\n methods for connecting disconnecting.\n - The [getConnections](https://secure.php.net/manual/en/mongoclient.getconnections.php)\n method is not implemented because the underlying driver does not offer a method\n to retrieve this data.\n - The [killCursor](https://php.net/manual/en/mongoclient.killcursor.php) method\n is not yet implemented.\n\n## MongoDB\n - The [authenticate](https://secure.php.net/manual/en/mongodb.authenticate.php)\n method is not supported. To connect to a database with authentication, please\n supply the credentials using the connection string.\n - The `$cmd` collection cannot be used due to an issue in the underlying driver.\n To run commands, use the [command](https://secure.php.net/manual/en/mongodb.command.php)\n method instead of querying the virtual `$cmd` collection.\n\n## MongoCollection\n\n - The [insert](https://php.net/manual/en/mongocollection.insert.php),\n [batchInsert](https://php.net/manual/en/mongocollection.batchinsert.php),\n and [save](https://php.net/manual/en/mongocollection.save.php)\n methods take the first argument by reference. While the original API does not\n explicitely specify by-reference arguments it does add an ID field to the\n objects and documents given.\n - The [parallelCollectionScan](https://php.net/manual/en/mongocollection.parallelcollectionscan.php)\n method is not yet implemented.\n\n## MongoCursor\n - The [info](https://php.net/manual/en/mongocursor.info.php) method does not\n reliably fill all fields in the cursor information. This includes the `numReturned`\n and `server` keys once the cursor has started iterating. The `numReturned` field\n will always show the same value as the `at` field. The `server` field is lacking\n authentication information.\n - The [setFlag](https://php.net/manual/en/mongocursor.setflag.php)\n method is not yet implemented.\n - The [timeout](https://php.net/manual/en/mongocursor.timeout.php) method will\n not change any query options. Client-side timeouts are no longer supported by\n the new driver. Use the maxTimeMS setting as a replacement.\n\n## MongoCommandCursor\n - The [createFromDocument](https://php.net/manual/en/mongocommandcursor.createfromdocument.php)\n method is not yet implemented.\n - The [info](https://php.net/manual/en/mongocommandcursor.info.php) method does not\n reliably fill all fields in the cursor information. This includes the `at`, `numReturned`,\n `firstBatchAt` and `firstBatchNumReturned` fields. The `at` and `numReturned`\n fields always return 0 for compatibility to MongoCursor. The `firstBatchAt` and\n `firstBatchNumReturned` fields will contain the same value, which is the internal\n position of the iterator.\n\n# Development\n\nIf you are working on patches to this driver, you can run the unit tests by following these steps from the root of the repo directory:\n\n    $ composer install\n    $ vendor/phpunit/phpunit/phpunit --verbose\n\nIt assumes that the the `localhost` is running a mongod server. Here is a sample command to start mongod for these tests:\n\n    $ mongod --smallfiles --fork --logpath /var/log/mongod.log --setParameter enableTestCommands=1\n\nThe tests also assume PHP 5.6+ and the `ext-mongodb` extension being available.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falcaeus%2Fmongo-php-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falcaeus%2Fmongo-php-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falcaeus%2Fmongo-php-adapter/lists"}