HTTP bindingΒΆ

The HTTP binding is the most simple and immediate part of Orient.

It’s a bunch of classes which work together in order to take advantage of OrientDB’s HTTP interface.

Typically, you will use:

  • an HTTP Client class ( default one is cURL )
  • the binding class
  • an HTTP Response class

In order to use the HTTP binding, you only need to instantiates 2 objects and pass’em a few configurations for OrientDB.

The first one is the HTTP client, which accepts, as parameters, whether to persist various HTTP connections parameters and the timeout:

use Congow\Orient\Http\Client\Curl;
use Congow\Orient\Foundation\Binding;

$client = new Curl(true, 5);

The second one is the binding, to which you need to pass an HTTP client and host|port for OrientDB:

$orient = new Binding($client, '127.0.0.1', '2480');

Optional, parameters are the server credentials and the name of the DB you want to interact with:

$orient = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'myDB');

In order to retrieve a document, you only need to:

$response = $orient->getDocument('11:0');

the result of getDocument() is an HTTP response ( Congow\Orient\Http\Response ) and you only need to parse the Response ( in JSON format ):

json_decode($response->getBody());

The HTTP binding class has a few methods to interact with OrientDB’s HTTP interface, so we strongly encourage you to directly look at the public methods of that class in order to understand what you can do with it.

Previous topic

Installation

Next topic

Implementation of lazy loading

This Page