These forums are read-only and for archival purposes only!
Please join our new forums at
  • I have recently started looking at graph db's as they seem to make more sense than traditional rdbms for sites that do a lot of joins such as social network sites etc. The neo4j db looks quite nice. It even has the Lucene serach engine built in. Has anyone tried this db and used it with Kohana?


  • im seriously gonna look in with this, it looks stunning! thnx for sharing

  • I agree, the more I look into it the more sense it makes to put all data in a graph db. Should make advanced queries a breeze and enable cool features like recommendation engines, friends of friends, news aggregation streams etc. I found a few PHP wrappers that I will try to use with Kohana.

  • I found this PHP wrapper that seems to be the best one out there so far: Anyone have any suggestions on what would be the best way to integrate this with Kohana?


  • Well basically I think this needs to be a standalone library which you use within your models, I can't seem to find a legit reason to integrate this with ORM and Database modules. The use of relational mapping and querying is so practical easy, that you could use it without the need of those modules.

  • That's kind of what I thought. Where should the library be loaded? In each model or in the bootstrap? Or maybe create a neo4j model that is extended? I was thinking of maybe doing a wrapper class to use Kohana configs etc. What do you think? I have never integrated a driver with kohana so I am not really sure what the best solution is.

  • Hmm maybe create a module which basically just creates a instance of the Neo4J lib? Like a factory class

  • Thanks for your reply! I can't seem to find any docs on how to build factory based modules. I am guessing the structure would be similar to

  • Just a very simple instance creator, the email module from shadowhand is a real wrapper.

  • I understand. I have looked a little further into PHP patterns. Shouldn't a database driver use a singleton pattern? Or am I missing something?

    Thanks for your help!

  • @Surfer read the warning below ;)

  • Yeah I saw that but looking in other Kohana modules I see the frequent use of singleton? Is the general consensus to skip singeltons and just keep track of one instance?

  • So the idea is just to do this?

    class Kohana_Neo4j {
    public static function factory()
        require_once Kohana::find_file('vendor', 'neo4jphp/neo4jphp.phar');
        $config = Kohana::$config->load('neo4j');
        $client = new Everyman\Neo4j\Client($this->_config['host'], $this->_config['port']);
        return $client;
  • Sort of yes :)

  • @surfer how's going with neo4j and kohana? Do you think to release your wrapper class when it will be ready? I really would like to know your experiences with it because i'm going to try it in a php project next month.

    Bye Marco

  • Hey, sorry for the late reply @MarcoCapoferri. I basically just ended up doing something similar to the above code and using the neo4jphp wrapper.

  • dbHey @Surfer thanks for your replay. Mine is later than yours :D Do you think to release your work as a module?

    In the last 2 weeks I tried orientdb with a PHP wrapper, as a document DB not as graph db.. now I'm going to finish my work with this DB and I'll try to package a module (still need some advanced features and documentation.. no test suites for now because I lack of knowledge with phpunit...)


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion