alcaeus / mongodb-gridfs-wrapper
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
Requires
- php: ^5.5
- ext-mongo: ^1.5
Requires (Dev)
- phpunit/phpunit: 4.8.*
This package is auto-updated.
Last update: 2023-05-03 17:40:30 UTC
README
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:
Alcaeus\GridFs\StreamWrapper::register();
Caveats
- Stream options (blocking, timeouts, etc.) are not supported yet
- The wrapper currently only works for servers that don't require authentication.
- Directory iterators are not supported (yet)
- File locking is not supported (yet)
- When renaming files, database and bucket must remain the same (for now)