Goals If you are a PHP developer, this guide provides an overview of options for connecting to Neo4j. While this guide is not comprehensive it will introduce the different drivers and link to the relevant resources. Prerequisites You should be… Learn More →

Goals
If you are a PHP developer, this guide provides an overview of options for connecting to Neo4j. While this guide is not comprehensive it will introduce the different drivers and link to the relevant resources.
Prerequisites
You should be familiar with graph database concepts and the property graph model. You should have installed Neo4j and made yourself familiar with our Cypher Query language.
Intermediate


Neo4j for PHP Developers

neo4j loves php

You’re a PHP developer and want to start with Neo4j? You’re in the right place!

Whether you’re using frameworks like Symfony and Laravel or you’re developing without frameworks, you’ll find an adequate library for your use case.

If you have any questions, you can always find a community member around on Twitter or StackOverflow by tagging your subjects with #neo4j-php.

Members of the PHP community have invested a lot of time and love to develop all these drivers, so please if you use them, provide feedback to the authors.

The Example Project

It is a small one page webapp for our movies database. The front-end page is the same for all drivers, it consists of a movie search, detail info and a graph visualization of actors and movies. Each backend implementation shows you how to connect to Neo4j from the different languages and drivers.

You can learn more about our small, consistent example project across many different language drivers here. You find the implementations for all drivers as individual GitHub repositories, that you can clone and deploy directly.

Using Neo4j in a standalone PHP environment

If you prefer to develop without frameworks, these libraries are made for you:

Neo4jPHP

Neo4jPHP provides an API that is both intuitive and flexible, and it takes advantage of ‘under-the-hood’ performance enhancements, such as caching and lazy-loading.

NeoClient

NeoClient is a powerful and flexible PHP Client for Neo4j with MultiDB support, and full High-Availability support for Neo4j Enterprise, and a convenient object formatter for handling graph results. It is built on top of the Symfony components, which makes integrating it in a modern PHP framework very easy. The 2.0 stable release has been announced end of November 14, with the following changes and improvements:

  • Everything is built as an extension, meaning the core commands are an extension to the library, which makes the library very flexible and customizable.
  • All commands are registered as lazy services, improving the library performance.
  • The Service Container can be cached, gaining up to 300% performance when runnning in production.
  • Full High-Availability support, with master re-election detection, slaves fallback built-in mechanism, and convenience methods for directing write and read queries to different databases.
  • Minimalistic HA mechanism when running Neo4j Community Edition
  • Full-fledged Response Graph format
  • Enterprise support by GraphAware

Neo4j-OGM-PHP

This library provides a basic Object-Graph mapping system and is built on top of Doctrine and the Neo4jPHP library.


With the Symfony framework

If you’re using the Symfony framework, these bundles are available to you:

Neo4jOGMBundle

This bundle is wraps the Neo4j-PHP-OGM library mentioned above.


NeoEloquent for Laravel

Neo4j Graph Eloquent Driver for Laravel 4

Neo4Laravel

A Neo4j Laravel 4.1 OGM Provider.


Other Drivers

neo4j-pdo

This is a PHP Data Objects driver for the Neo4j graph database, it allows you to connect to a Neo4j server from PHP using the standard PDO API. The project currently only implements a “vanilla” PHP implementation, which means you need to use a special constructor to create your PDO connection. PHP extensions to register the driver with PDO in HHVM and Zend VM are planned future work.

PHP Cypher

A PHP adapter for Neo4j REST API Cypher endpoint.


Applications built with PHP and Neo4j

Omnomhub

Like for Github, but for recipes!

Thesaurus Manager

If you want to built your own thesaurus, this app is made for you

Graphgen

Graph generation engine based on the Cypher DSL