PHP code example of juststeveking / neo4j-http-adapter

1. Go to this page and download the library: Download juststeveking/neo4j-http-adapter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

juststeveking / neo4j-http-adapter example snippets




use JustSteveKing\Graph\Connection\Adapters\Neo4j\Adapters\Http\HttpAdapter;

$adapter = HttpAdapter::build(
    'http://neo4j:password@localhost:7474',
    'my_database'
);



use JustSteveKing\Graph\Connection\Adapters\Neo4j\Adapters\Http\HttpAdapter;

$adapter = HttpAdapter::build(
    'http://neo4j:password@localhost:7474',
    'my_database'
);

$database = $adapter->on('database-name');



use JustSteveKing\Graph\Connection\Adapters\Neo4j\Adapters\Http\HttpAdapter;

$adapter = HttpAdapter::build(
    'http://neo4j:password@localhost:7474',
    'my_database'
);

$database = $adapter->on('database-name');

// Add a query to the transaction pipeline.
$database->query('MATCH (person:Person) WHERE person.name = "Tom Hanks" RETURN person');

// Add another query to the transaction pipeline
$database->query('MATCH (film:Film) WHERE film.name = "Forrest Gump" RETURN film');

use JustSteveKing\Graph\Connection\Adapters\Neo4j\Adapters\Http\HttpAdapter;

$adapter = HttpAdapter::build(
    'http://neo4j:password@localhost:7474',
    'my_database'
);

$database = $adapter->on('database-name');

// Add a query to the transaction pipeline.
$database->query('MATCH (person:Person) WHERE person.name = "Tom Hanks" RETURN person');

$response = $database->send();



use JustSteveKing\Graph\Connection\Adapters\Neo4j\Adapters\Http\HttpAdapter;

$adapter = HttpAdapter::build(
    'http://neo4j:password@localhost:7474',
    null
);

$actorsDatabase = $adapter->on('actors');

$tomHanks = $actorsDatabase->query('MATCH (person:Person) WHERE person.name = "Tom Hanks" RETURN person')->send();



use JustSteveKing\Graph\Connection\Adapters\Neo4j\Adapters\Http\HttpAdapter;

$tomHanks = HttpsAdapter::build(
    'http://neo4j:password@localhost:7474',
    'actors'
)->query('MATCH (person:Person) WHERE person.name = "Tom Hanks" RETURN person')->send();



use JustSteveKing\Graph\Builder\Cypher;
use JustSteveKing\Graph\Connection\ConnectionManager;
use JustSteveKing\Graph\Connection\Adapters\Neo4j\Adapters\Http\HttpAdapter;

$connection = ConnectionManager::create(HttpAdapter::build('http://neo4j:password@localhost:7474', null));
$query = Cypher::query()->match('Person', 'person')->where('person', 'name', '=', 'Tom Hanks')->return('person');
$connection->use('neo-http')->on('neo4j')->query($query)->send();