This bundle provides a simple integration of the Neo4j PHP Object Graph Mapper into Symfony2

Installs: 24 793

Dependents: 0

Suggesters: 0

Security: 0

Stars: 29

Watchers: 5

Forks: 9

Open Issues: 5


dev-master 2012-11-20 20:30 UTC

This package is not auto-updated.

Last update: 2024-06-30 02:53:04 UTC


Neo4j OGM Bundle

This bundle provides a simple integration of the "Neo4j PHP Object Graph Mapper" from Louis-Philippe Huberdeau into Symfony2. The Neo4j OGM is an object management layer built on top of Josh Adell's Neo4jPHP. It allows manipulation of data inside the Neo4j graph database through the REST connectors.


To install this bundle, add this to your project's composer.json:

"require": {
    // ...
    "klaussilveira/neo4j-ogm-bundle": "dev-master",

Next, update your vendors by running:

$ composer update

Now enable the bundle in the kernel:

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new Neo4j\OGM\OGMBundle\Neo4jOGMBundle(),

And configure the bundle by adding the neo4j_ogm namespace into config.yml:

    host: 'localhost'
    port: 7474

Congratulations! You're ready to use Neo4j OGM into Symfony2.

Basic Usage

The only thing to do is to request the neo4j.manager service from the container to get an instance of HireVoice\Neo4j\EntityManager.


$em = $this->container->get('neo4j.manager');
$repo = $em->getRepository('Entity\\User');
$john = $repo->findOneByFullName('John Doe');

$list = $em->createCypherQuery()
    ->startWithNode('john', $john)
    ->match('john -[:follow]-> followedBy <-[:follow]- similarInterest')
    ->match('similarInterest -[:follow]-> potentialMatch')
    ->end('potentialMatch', 'count(*)')
    ->order('count(*) DESC')


You can easily configure the Neo4j OGM by changing neo4j_ogm on your config.yml:

    transport: 'curl'
    host: 'localhost'
    port: 7474
    username: 'test'
    password: '123456'
    proxy_dir: '/tmp'
    debug: true