2017 © Pedro Peláez
 

library mongo-php-adapter

Adapter to provide ext-mongo interface on top of mongo-php-libary

image

alcaeus/mongo-php-adapter

Adapter to provide ext-mongo interface on top of mongo-php-libary

  • Sunday, July 8, 2018
  • by alcaeus
  • Repository
  • 23 Watchers
  • 302 Stars
  • 1,351,305 Installations
  • PHP
  • 74 Dependents
  • 33 Suggesters
  • 91 Forks
  • 4 Open issues
  • 30 Versions
  • 14 % Grown

The README.md

Mongo PHP Adapter

Build Status Code Coverage Scrutinizer Code Quality, (*1)

The Mongo PHP Adapter is a userland library designed to act as an adapter between applications relying on ext-mongo and the new driver (ext-mongodb)., (*2)

It provides the API of ext-mongo built on top of mongo-php-library, thus being compatible with PHP 7., (*3)

Goal

This library aims to provide a compatibility layer for applications that rely on libraries using ext-mongo, e.g. Doctrine MongoDB ODM, but want to migrate to PHP 7 on which ext-mongo will not run., (*4)

You should not be using this library if you do not rely on a library using ext-mongo. If you are starting a new project, please check out mongodb/mongodb., (*5)

Installation

This library requires you to have the mongodb extension installed, and it conflicts with the legacy mongo extension., (*6)

The preferred method of installing this library is with Composer by running the following from your project root:, (*7)

$ composer config "platform.ext-mongo" "1.6.16" && composer require alcaeus/mongo-php-adapter

The above command first marks the mongo extension as installed, then requires this adapter. This is to work around a bug in composer, see composer/composer#5030., (*8)

Known issues

Return values and exceptions

Some methods may not throw exceptions with the same exception messages as their counterparts in ext-mongo. Do not rely on exception messages being the same., (*9)

Methods that return a result array containing a connectionId field will always return 0 as connection ID., (*10)

Errors

All errors and warnings triggered by ext-mongo are triggered as E_USER_WARNING and E_USER_ERROR because trigger_error doesn't accept the E_WARNING and E_USER codes. If you rely on these error codes in your error handling routines, please update your code accordingly., (*11)

Serialization of objects

Serialization of any Mongo* objects (e.g. MongoGridFSFile, MongoCursor, etc.) will not work properly. The objects can be serialized but are not usable after unserializing them., (*12)

Mongo

  • The Mongo class is deprecated and was not implemented in this library. If you are still using it please update your code to use the new classes.

MongoLog

  • The MongoLog class does not log anything because the underlying driver does not offer a method to retrieve this data.

MongoClient

  • The connect and close methods are not implemented because the underlying driver connects lazily and does not offer methods for connecting disconnecting.
  • The getConnections method is not implemented because the underlying driver does not offer a method to retrieve this data.
  • The killCursor method is not yet implemented.

MongoDB

  • The authenticate method is not supported. To connect to a database with authentication, please supply the credentials using the connection string.
  • The $cmd collection cannot be used due to an issue in the underlying driver. To run commands, use the command method instead of querying the virtual $cmd collection.

MongoCollection

  • The insert, batchInsert, and save methods take the first argument by reference. While the original API does not explicitely specify by-reference arguments it does add an ID field to the objects and documents given.
  • The parallelCollectionScan method is not yet implemented.

MongoCursor

  • The info method does not reliably fill all fields in the cursor information. This includes the numReturned and server keys once the cursor has started iterating. The numReturned field will always show the same value as the at field. The server field is lacking authentication information.
  • The setFlag method is not yet implemented.
  • The timeout method will not change any query options. Client-side timeouts are no longer supported by the new driver. Use the maxTimeMS setting as a replacement.

MongoCommandCursor

  • The createFromDocument method is not yet implemented.
  • The info method does not reliably fill all fields in the cursor information. This includes the at, numReturned, firstBatchAt and firstBatchNumReturned fields. The at and numReturned fields always return 0 for compatibility to MongoCursor. The firstBatchAt and firstBatchNumReturned fields will contain the same value, which is the internal position of the iterator.

Development

If 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:, (*13)

$ composer install
$ vendor/phpunit/phpunit/phpunit --verbose

It assumes that the the localhost is running a mongod server. Here is a sample command to start mongod for these tests:, (*14)

$ mongod --smallfiles --fork --logpath /var/log/mongod.log --setParameter enableTestCommands=1

The tests also assume PHP 5.6+ and the ext-mongodb extension being available., (*15)

The Versions

08/07 2018

dev-master

9999999-dev

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

07/07 2018

dev-remove-unsupported-phpunit-config-attribute

dev-remove-unsupported-phpunit-config-attribute

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

07/07 2018

dev-fix-undefined-write-error-access

dev-fix-undefined-write-error-access

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

05/03 2018

1.1.5

1.1.5.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

05/03 2018

dev-test-all-driver-versions

dev-test-all-driver-versions

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

05/03 2018

dev-bump-phpunit

dev-bump-phpunit

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

24/01 2018

1.1.4

1.1.4.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

24/09 2017

1.1.3

1.1.3.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

19/08 2017

dev-commands-apply-primary-readpreference

dev-commands-apply-primary-readpreference

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

04/08 2017

1.1.2

1.1.2.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

30/06 2017

1.1.1

1.1.1.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

13/05 2017

1.1.0

1.1.0.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

27/04 2017

1.0.x-dev

1.0.9999999.9999999-dev

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

27/04 2017

1.0.11

1.0.11.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

29/03 2017

1.0.10

1.0.10.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

29/01 2017

1.0.9

1.0.9.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

11/01 2017

1.0.8

1.0.8.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

18/12 2016

1.0.7

1.0.7.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

07/10 2016

1.0.6

1.0.6.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

08/08 2016

dev-hhvm-compatibility

dev-hhvm-compatibility

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

03/07 2016

1.0.5

1.0.5.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

22/06 2016

1.0.4

1.0.4.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

13/04 2016

1.0.3

1.0.3.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

08/04 2016

1.0.2

1.0.2.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

01/04 2016

1.0.1

1.0.1.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

18/03 2016

1.0.0

1.0.0.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

25/02 2016

dev-composer-provide

dev-composer-provide

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

23/02 2016

dev-composer-replace

dev-composer-replace

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

17/02 2016

1.0.0-BETA1

1.0.0.0-beta1

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database

06/02 2016

0.1.0

0.1.0.0

Adapter to provide ext-mongo interface on top of mongo-php-libary

  Sources   Download

MIT

The Requires

 

The Development Requires

by Olivier Lechevalier

mongodb database