2017 © Pedro Peláez
 

symfony-bundle php-mongodb-client-bundle

image

ulff/php-mongodb-client-bundle

  • Friday, September 29, 2017
  • by ulff
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 25 % Grown

The README.md

PhpMongodbClientBundle

A Symfony bundle for MongoDB. Compatible with new mongodb driver, unlike the doctrine/mongodb which is compatible only with deprecated and no longer supported mongo driver., (*1)

See: https://docs.mongodb.com/ecosystem/drivers/php/#compatibility, (*2)

Installation and configuration

Step 1: Install bundle

Install bundle using composer:, (*3)

php composer.phar require "ulff/php-mongodb-client-bundle:dev-master"

Enable the bundle in AppKernel.php:, (*4)

// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Ulff\PhpMongodbClientBundle\UlffPhpMongodbClientBundle(),
    ];

    // ...
}

Step 2: add bundle configuration

Add configuration to config.yml. Minimal required is:, (*5)

# app/config/config.yml

ulff_php_mongodb_client:
    connection:
        host: hostname-here

There are also other configuration options, like:, (*6)

# app/config/config.yml

ulff_php_mongodb_client:
    connection:
        host: hostname-here
        port: 27017               # optional, default 27017
        username: username-here   # optional, default not set
        password: password-here   # optional, default not set
    options: { }
        # any custom connection options here, passed as assoc array

Replace values with proper ones., (*7)

Usage

Client usage

Mongodb client is available as a service:, (*8)

$client = $this->get('ulff_php_mongodb_client.client');

Getting manager

Service provides access to the mongodb manager:, (*9)

$manager = $this->get('ulff_php_mongodb_client.client')->getManger();

The Versions

29/09 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

mongodb symfony2 bundle symfony3 mongo php7 php5 php-mongo

29/09 2017

dev-develop

dev-develop

  Sources   Download

MIT

The Requires

 

mongodb symfony2 bundle symfony3 mongo php7 php5 php-mongo