Developed with love by KnpLabs Hire us for your project!
0

MopArangoDbBundle

by m0ppers

Symfony2 Bundle to handle integration with ArangoDB

MopArangoDbBundle

This is a simple integration of ArangoDb (http://arangodb.org) into Symfony2

Status

This is HIGHLY experimental as is ArangoDb itself and its somewhat hackish xD

What does the integration do?

This bundle handles several things:

  1. It makes arangodb connections configurable in symfony
  2. It provides a neat DataCollector so you will see what's happening in the symfony profiler
  3. It comes with a FOSUser integration (which should be in a separate bundle but whatever)

Installation

It's a normal symfony bundle so installation should be straight forward. There is no composer integration via packagist yet
due to its experimental status. You can install the bundle via composer easily nevertheless:

Step 1: Register this github repository in the repositories section of your composer.json

"repositories": [
...
{
"type":"vcs",
"url":"https://github.com/m0ppers/MopArangoDbBundle.git"
}
...
],

Step 2: This bundle needs ArangoDB-PHP. Add both bundles to your composer.json:

"require": {
..
"mop/arangodbbundle" : "dev-master",
"triagens/ArangoDb": "2.0.*",
..
}

ArangoDb-PHP comes with lots of documentation & examples. Check it out here:

https://github.com/triAGENS/ArangoDb-PHP

Basic Configuration

Connections

in app/config/config.yml:

mop_arango_db:
    default_connection: main # optional will be set to the first connection if not present
    connections:
        main: 
            host: 127.0.0.1
            port: 8529

Should be pretty obvious. Once configured the Bundle handles the lazy loading of the connections.

You can now access your avocado connections using the DI-Container of sf2:
```
$connection = $container->get('mop_arangodb.default_connection');

or

$connection = $container->get('mop_arangodb.connections.main');
```

FOS Userbundle integration

mop_arango_db:
    fos:
        connection: main
        collection: users

Afterwards create the collection in arangodb.

Then you will have to tell fos that it should use the arangodb driver:

fos_user:
    db_driver: custom
    user_class: Acme\DemoBundle\Entity\User
    firewall_name: main
    service:
        user_manager: mop_arangodb.fos.user_manager
Copyright (c) 2012 Andreas Streichardt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
mop_arangodb:
default_connection: ~
connections:

# Prototype
name:
host: ~
port: 8529
database: _system
user: root
password: password
fos:
connection: ~
collection: ~