PHP code example of php-rexster / rexster

1. Go to this page and download the library: Download php-rexster/rexster 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/ */

    

php-rexster / rexster example snippets


$graph = new Graph('http://localhost:8182', 'testing');

$vertex = $graph->getVertex($vertex_id);

$edge = $graph->getEdge($edge_id);

$vertex = $graph->getVertexByAttribute('name', $name);

$graph->setOffsetStart(5);
$graph->setOffsetEnd(10);
$vertices = $graph->getVertices();

$vertex = new Vertex($graph);
$vertex->some_property = "some property";
$vertex->another_attribute = "haay";
$vertex->create();

$edge = new Edge($graph);
$e->some_property = 'edge name property';
$e->_inV = 4;
$e->_outV = 8;
$e->_label = "knows";

$vertex = $graph->getVertex($vertex_id);
$vertex->createOutEdge($to_vertex_id, 'likes', $data);
$vertex->createInEdge($from_vertex_id, 'likes', $data);

$gr = new Gremlin($g);
$response = $gr->runScript("g.v({$vertex_id}).out.path");