2017 © Pedro Peláez
 

library mongol

MongoDB library and Auth driver for Laravel 4

image

flatline/mongol

MongoDB library and Auth driver for Laravel 4

  • Tuesday, April 16, 2013
  • by Flatline
  • Repository
  • 1 Watchers
  • 2 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

laravel-mongol

MongoDB library and Auth driver for Laravel 4., (*1)

It extends PHP's MongoDB Native Driver., (*2)

Installation

Require flatline/mongol in your project's composer.json:, (*3)

{
    "require": {
        "flatline/mongol": "0.1.*"
    }
}

Update or install your packages with composer update or composer install respectively., (*4)

Now you need to register MongolServiceProvider with Laravel.
Open up app/config/app.php and add the following to the providers key:, (*5)

'Flatline\Mongol\MongolServiceProvider'

You can also register the facade in the class aliases, look for the aliases key and add the following:, (*6)

'Mongol' => 'Flatline\Mongol\Mongol'

This way you can use Mongol::connection() instead of Flatline\Mongol\Mongol::connection()., (*7)

Configuration

In order to use your own database credentials you can extend the package configuration by creating app/config/packages/flatline/mongol/config.php., (*8)

You can do this by running the following Artisan command., (*9)

$ php artisan config:publish flatline/mongol

Here's an example configuration using mongohq, (*10)

'default' => array(
    'host'     => 'alex.mongohq.com',
    'port'     => 10002,
    'username' => 'your_username',
    'password' => 'your_db_password',
    'database' => 'your_db_name',
),

You can also connect as admin, (*11)

'other_credentials' => array(
    'host'     => 'localhost',
    'username' => 'your_admin_username',
    'password' => 'your_admin_db_password',
    'database' => 'your_db_name',
    'admin'    => true,
),

You can create as many database credential groups as you need., (*12)

Auth Driver configuration

To use Mongol with the Auth library, just set 'mongol' as the driver in app/config/auth.php:, (*13)

'driver' => 'mongol'

Usage

You use it the same way you would use the native driver, but first you need to get the connection and database., (*14)

To get your default connection use:, (*15)

Mongol::connection();

To get other connection:, (*16)

Mongol::connection('group');

To get the database just use:, (*17)

Mongol::connection()->getDB();

And to get other db using the same credentials (you must be authenticated as admin), you can use:, (*18)

Mongol::connection()->getDB('other_db_name')

The Versions

16/04 2013

dev-develop

dev-develop http://github.com/xFlatlinex/mongol

MongoDB library and Auth driver for Laravel 4

  Sources   Download

MIT

The Requires

 

mongodb laravel auth driver mongo

30/01 2013

dev-master

9999999-dev http://github.com/xFlatlinex/laravel-mongol

MongoDB library and Auth driver for Laravel 4

  Sources   Download

MIT

The Requires

 

mongodb laravel auth driver mongo

30/01 2013

0.1.2

0.1.2.0 http://github.com/xFlatlinex/laravel-mongol

MongoDB library and Auth driver for Laravel 4

  Sources   Download

MIT

The Requires

 

mongodb laravel auth driver mongo

22/01 2013

0.1.1

0.1.1.0 http://github.com/xFlatlinex/laravel-mongol

MongoDB library and Auth driver for Laravel 4

  Sources   Download

MIT

The Requires

 

mongodb laravel auth driver mongo

15/01 2013

0.1.0

0.1.0.0 http://github.com/xFlatlinex/laravel-mongol

MongoDB library and Auth driver for Laravel 4

  Sources   Download

MIT

The Requires

 

mongodb laravel auth driver mongo