Currently, I am still learning the Neo4J Graph Database and plan to migrate my current RDBMS into Graph Database. So I was searching the methodology of how to connect Neo4J in PHP/Codeigniter until i found out that Neoxygen-NeoClient was the answer.
After I installed it using composer then i planning to test it. I created a new page called connection.php and placed in a root folder. Unfortunately right now i'm having some problem when to get data from Neo4J in my localhost and
And below is the contains of connection.php
<?php
require_once 'vendor/autoload.php';
use Neoxygen\NeoClient\ClientBuilder;
$client = ClientBuilder::create()
->addConnection('default', 'http', 'myserver.dev', 7474, true, 'username', 'password')
->build();
$q = 'MATCH (n:Actor) RETURN n.name';
$client->sendCypherQuery($q);
$result = $client->getRows();
echo $result;
?>
So the result from that query is not shown and i would like to ask how to display the return query from Neo4J in PHP ?
Updated
I was trying to testing from your example of running application in here https://github.com/ikwattro/neo4j-neoclient-example
Then i followed your installation steps then ran it on localhost But still couldnt display the data from Neo4J then after i check the Web Console, i got this error
http://localhost/search?q=Matrix Failed to load resource: the server responded with a status of 404 (Not Found) localhost/graph Failed to load resource: the server responded with a status of 404 (Not Found) localhost/search?q=Matrix Failed to load resource: the server responded with a status of 404 (Not Found)
So I guess the problem is I don't get the graph and search folder after i did composer installation and i got only vendor folder
composer install --no-dev --optimize-autoloader
Could you please verify this ? If that's not the case, please give me some solution to resolve this issue.
And also could you please explain what you mean to run application using
http://localhost:8000/import
Thanks before
I'm the maintainer of NeoClient.
First, if you need to handle results, you should activate the response formatter :
You have now multiple possibilities to get your results back :
In a table format like in the Neo4j browser :
Or, if you want to manipulate nodes and relationships objects :
You can also make use of the identifier with the get method :
I wrote 3 articles on Sitepoint about Neo4j and PHP with NeoClient, I'm sure they can help you :
http://www.sitepoint.com/author/ikwattro/
UPDATE
I checked the Neo4j-MovieDB-Repository I did a while ago, and I updated the README with how to test it locally.
For your updated questions :
Make sure you run the webserver with the good root path defined, so if your current directory is $myrepo/web, then
php -S localhost:8000
will be ok, if you are in the parent directory, you need to provide the web index root as argumentphp -S localhost:8000 -t web/
the url
http://localhost:8000/importdb
is made in order to load data in the database, otherwise he will not find movies and actors.If you still have errors or issues, please open a separate SO question or trigger an issue on Github https://github.com/ikwattro/neo4j-moviedb-example/issues