Giter VIP home page Giter VIP logo

neo4j-ogm-bundle's Introduction

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.

Installation

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:

<?php
// 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:

neo4j_ogm:
    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.

<?php

$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')
    ->limit(10)
    ->getList();

Configuration

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

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

neo4j-ogm-bundle's People

Contributors

deltachaos avatar klaussilveira avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.