Mongo

Overview

Uses the Mongo Document Database for storing and retrieving objects in OAuth.

Installation

First, install the Mongo Extension for PHP You can use PECL:

Text
$ sudo pecl install mongo

Or install manually. Download the latest version of the code from github.

Text
$ tar zxvf mongodb-mongodb-php-driver-<commit_id>.tar.gz
$ cd mongodb-mongodb-php-driver-<commit_id>
$ phpize
$ ./configure
$ make all
$ sudo make install

Next, enable the mongo.so extension in your php.ini file:

Text
extension=mongo.so

Get Started

Once this is done, create a mongo client to connect to the mongo server.

Php
$mongo = new \MongoClient();

Now, create the storage object using the Mongo storage class:

Php
$storage = new OAuth2\Storage\Mongo($mongo);

// now you can perform storage functions, such as the one below
$storage->setClientDetails($client_id, $client_secret, $redirect_uri);

Usage

The Mongo storage engine implements all the standard Storage Interfaces supported in this library. See interfaces for more information.

Fork me on GitHub