sgpatil/orientdb-php

PHP Wrapper for the Orientdb database (REST)

v0.0.3 2016-02-12 12:57 UTC

This package is not auto-updated.

Last update: 2024-11-03 09:01:35 UTC


README

Author: Sumit Patil sgpatil.2803@gmail.com
Copyright (c) 2014-2015

PHP Wrapper for the Orientdb graph database REST interface

Installation

Add the package to your composer.json

{
    "require": {
        "sgpatil/orientdb-php": "dev-master"
    }
}

Connection

$client = new Sgpatil\Orientphp\Client(<server>, <port>, <database_name>);

$client->getTransport()
       ->setAuth(<database_user_name>, <database_password>);

If you are using default configuration then the code should be

$client = new Sgpatil\Orientphp\Client("localhost", 2480, <database_name>);

$client->getTransport()
       ->setAuth('root', 'root');

To check database connection.

print_r($client->getServerInfo());

This will display server information.

Create Class

 $user = $client->makeClass("User", function($property){
        $property->string("name");
        $property->integer("age");
        $property->timestamp("datetime");
    })->save();

Supporting Datatype

|
|$property->byte('<field_name>'); |$property->boolean('<field_name>'); |
|$property->float('<field_name>'); |$property->double('<field_name>'); |
|$property->datetime('<field_name>'); |$property->date('<field_name>'); |$property->timestamp('<field_name>'); |
|$property->string('<field_name>'); |$property->binary('<field_name>'); |
|$property->embedded('<field_name>'); |$property->embeddedlist('<field_name>'); |$property->embeddedset('<field_name>'); |
|$property->link('<field_name>'); |$property->linklist('<field_name>'); |$property->linkset('<field_name>'); |$property->linkmap('<field_name>'); |$property->linkbag('<field_name>'); |
|$property->custom('<field_name>'); |$property->any('<field_name>');