0

I am creating a project in php and want to configure it with my Neo4j graph data. Here is the code:

<?php
require_once '/path/to/Client.php';
use GraphAware\Neo4j\Client; 
use GraphAware\Neo4j\Client\ClientBuilder;
$client = new GraphAware\Neo4j\Client('http://127.0.0.1:7474/');

$client = ClientBuilder::create()
->addConnection('default', 'http://neo4j:password@127.0.0.1:7474')
->addConnection('bolt', 'bolt://neo4j:password@127.0.0.1:7474')
->build();  

so you can see that the library I am trying to use in GraphAware. I cannot get this library to work as I do not have it. Can someone please let me know how I can get this library in my php project which I am creating in eclipse.

2 Answers2

3

As per the documentation, you use Composer to require it into your project.

https://github.com/graphaware/neo4j-php-client#installation

composer require graphaware/neo4j-php-client:^4.0

Don't have composer? It's well worth installing, manages dependencies and autoloading, and all you need to do to get it working with any PHP project is to add this line pretty much at the start point of your script (index.php?)

require_once 'vendor/autoload.php`

Get Composer here https://getcomposer.org/

The lame non-composer way is just download the Zip from github and dump it in your project. But you'll need to require in all the classes you use!

delboy1978uk
  • 12,118
  • 2
  • 21
  • 39
0

If your creating a PHP project in eclipse you can download the composer in eclipse form here: https://marketplace.eclipse.org/content/composer-php-support

All you have to do is drag it into your running workspace. This will download all the libraries and dependencies for you. This is done by writing composer before the require statement.

The composer for eclipse is available in the following versions: Mars(4.5), Luna(4.4), Kepler(4.3). It is also supported by Windows, Mac and Linux/GTK

Before you download the composer the PHP development tools (PDT) are required.

Just to add. I have tried this in eclipse mars but it did not work for me so I tried it in Neo Oxygen and it worked!