This package is abandoned and no longer maintained. No replacement package was suggested.

PHP stream wrapper for GridFS files in MongoDB

0.1.0 2015-11-28 14:58 UTC

This package is auto-updated.

Last update: 2023-05-03 17:40:30 UTC


Build Status

This library provides a PHP stream wrapper for GridFS files in MongoDB. This allows you to access files in GridFS with accessible URLs:

file_put_contents('gridfs://host/database-name/fs-prefix/path/to/file.txt', 'Hello world!');

The wrapper will accept directory separators in the path, but since there is no directory support in GridFS there won't be any real directories.

To use the stream wrapper, include this library in your composer dependencies:

composer require alcaeus/mongodb-gridfs-wrapper:^1.0@dev

Then, in your bootstrap process, register the stream wrapper:



  1. Stream options (blocking, timeouts, etc.) are not supported yet
  2. The wrapper currently only works for servers that don't require authentication.
  3. Directory iterators are not supported (yet)
  4. File locking is not supported (yet)
  5. When renaming files, database and bucket must remain the same (for now)