Included in the PHP 1.8 MongoDB driver library is a component called StreamWrapper. (in the MongoDB\GridFS namespace.) This component is compatible with the PHP stream_wrapper_register() function. This allows native PHP functions such as fopen() and fwrite() to access GridFS as if it were a file system.
I would like to use StreamWrapper but I cannot find any documentation on how to do so. I know you instantiate it using StreamWrapper::register() but that does not work alone. I have taken a look through the code and it seems I need to set a stream context option called ‘collectionWrapper’ but beyond that I am stumped. I have spent a long time looking for any relevant documentation too but have not been able to find any.
Do you know either where I can find documentation for the object or can you give me an example of how to use it?