php - NeoClientPHP Issue when retrieving data from Neo4J -
currently, still learning neo4j graph database , plan migrate current rdbms graph database. searching methodology of how connect neo4j in php/codeigniter until found out neoxygen-neoclient answer.
after installed using composer planning test it. created new page called connection.php , placed in root folder. unfortunately right i'm having problem when data neo4j in localhost ,
and below 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 result query not shown , ask how display return query neo4j in php ?
updated
i trying testing example of running application in here https://github.com/ikwattro/neo4j-neoclient-example
then followed installation steps ran on localhost still couldnt display data neo4j after check web console, got error
http://localhost/search?q=matrix failed load resource: server responded status of 404 (not found) localhost/graph failed load resource: server responded status of 404 (not found) localhost/search?q=matrix failed load resource: server responded status of 404 (not found)
so guess problem don't graph , search folder after did composer installation , got vendor folder
composer install --no-dev --optimize-autoloader
could please verify ? if that's not case, please give me solution resolve issue.
and please explain mean run application using
http://localhost:8000/import
thanks before
i'm maintainer of neoclient.
first, if need handle results, should activate response formatter :
$client = clientbuilder::create() ->addconnection('default', 'http', 'myserver.dev', 7474, true, 'username', 'password') ->setautoformatresponse(true) ->build();
you have multiple possibilities results :
in table format in neo4j browser :
$q = 'match (n:actor) return n.name'; $result = $client->sendcypherquery($q)->getresult()->gettableformat();
or, if want manipulate nodes , relationships objects :
$q = 'match (n:actor) return n'; $result = $client->sendcypherquery($q)->getresult(); $nodes = $result->getnodes(); $relationships = $result->getrelationships();
you can make use of identifier method :
$q = 'match (n:actor) return n'; $result = $client->sendcypherquery($q)->getresult(); $actors = $result->get('n');
i wrote 3 articles on sitepoint neo4j , php neoclient, i'm sure can :
http://www.sitepoint.com/author/ikwattro/
update
i checked neo4j-moviedb-repository did while ago, , updated readme how test locally.
for updated questions :
make sure run webserver root path defined, if current directory $myrepo/web,
php -s localhost:8000
ok, if in parent directory, need provide web index root argumentphp -s localhost:8000 -t web/
the url
http://localhost:8000/importdb
made in order load data in database, otherwise not find movies , actors.
if still have errors or issues, please open separate question or trigger issue on github https://github.com/ikwattro/neo4j-moviedb-example/issues
Comments
Post a Comment