Skip to content

Latest commit

 

History

History
executable file
·
90 lines (74 loc) · 2.07 KB

README.md

File metadata and controls

executable file
·
90 lines (74 loc) · 2.07 KB

Orientdb-php

Author: Sumit Patil [email protected]
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

Commands
$property->short('<field_name>');
$property->integer('<field_name>');
$property->long('<field_name>');

| |$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>');