Download the PHP package mts88/mongogrid without Composer

On this page you can find all versions of the php package mts88/mongogrid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mongogrid

Laravel MongoDB GridFS

Latest Stable Version Total Downloads License

A library wants to help the use of GridFS of MongoDB for Laravel 5. This library extends the original MongoDB GridFS Bucket for PHP, so many methods are exactly the same and others are simplified for the use.

Note

This is not a library for Eloquent or somenthing like this. It's a simple helper to easly use GridFS in Laravel. If you are looking for an Eloquent Model for MongoDB I suggest you jenssegers/laravel-mongodb.

Table of contents

Laravel version Compatibility

Laravel Package
< 5.5.x 1.1.x (not tested)
>= 5.5.x 1.1.x

Requirements

Make sure you have the MongoDB PHP driver installed. You can find installation instructions at http://php.net/manual/en/mongodb.installation.php

Installation

  1. Installation using composer:

  2. And add the service provider in config/app.php:

  3. You may also register an alias for the MongoGrid library by adding the following to the alias array in config/app.php:

Configuration

Run the command below to publish the package config file config/gridfs.php:

MongoDB Connection

You can use build-in configuration in config/gridfs.php or you can use config/database.php (compatible with jenssegers/laravel-mongodb).

Connection with config/gridfs.php

In config file config/gridfs.php set up your configuration in order to connect to MongoDB:

Simple Connection
ReplicaSet Connection

In your .env file add DB_REPLICA_SET property with the name of Replica Set

Connection with config/database.php

In config file config/gridfs.php set up your configuration name:

In config file config/database.php set up your configuration in order to connect to MongoDB: And add a new mongodb connection:

Simple Connection
ReplicaSet Connection

You can connect to multiple servers or replica sets with the following configuration:

DSN URL

Alternatively, you can use MongoDB connection string:

Please refer to MongoDB official docs for its URI format: https://docs.mongodb.com/manual/reference/connection-string/

Bucket Configuration

This is the config for GridFS Bucket:

For more details see MongoDB GridFS Bucket.

Metadata

By default the library adds these metadata to each document:

set false in config/gridfs.php file to not include this info.

Temporary Storage

By default the library use local driver for storing file into MongoDB. You can change the default driver of the Storage:

To learn more see Laravel File Storage.

Usage

Bucket Prefix

By default MongoGrid use the prefix in config/gridfs.php, but if you want you can use another custom prefix on the fly:

Storing File

storeFile( $fileContent, $fileName, [ optional $metadata] )

Store a file using contents, file name and your metadata (optional). Returns ObjectId

Or using another prefix

Get File

All method to get files from GridFS. Revision numbers are defined as follows:

Defaults to -1 (i.e. the most recent revision). Revision works only on method by filename.

getFileContent( $source, [optional $revision] )

You can retrive the content of file by his name or his ObjectId. You can use also the revision of the file.

getFile( $source )

You can retrive the content of file by his name or his ObjectId. Returns a document of the file collection.

findOne( $query, [ optional $options ] )

Finds a single document from the selected GridFS bucket matching the query.

To learn more about $options see MongoDB GridFS findOne.

find( $query, [ optional $options ] )

Finds all documents from the selected GridFS bucket matching the query.

download( $source, string $path, [optional $revision] )

Download a file from GridFS to a given path

NB: downloading a file with this method will increments downloads on metadata by itself (only if metadata are active).

Helpers

rename( $_id, $newName )

Rename a file.

delete( $_id )

Delete a file from the collection.

getBucketName()

Return the Collection Chunks of the selected GridFS Bucket

getChunksCollection()

Returns the name of the selected GridFS Bucket

getChunkSizeBytes()

Return the size of Chunks of the selected GridFS Bucket

getDatabaseName()

Return the name of the database used for selected GridFS

getFilesCollection()

Return the Collection File of the selected GridFS Bucket

drop()

Drop entire collections of a selected GridFS

Contact

Open an issue on GitHub if you have any problems or suggestions.

License

The contents of this repository is released under the MIT license.


All versions of mongogrid with dependencies

PHP Build Version
Package Version
Requires mongodb/mongodb Version ^1.3.0
ramsey/uuid Version ^3.7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mts88/mongogrid contains the following files

Loading the files please wait ....