Author: Sumit Patil [email protected]
Copyright (c) 2014-2015
PHP Wrapper for the Orientdb graph database REST interface
Add the package to your composer.json
{
"require": {
"sgpatil/orientdb-php": "dev-master"
}
}
$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.
$user = $client->makeClass("User", function($property){
$property->string("name");
$property->integer("age");
$property->timestamp("datetime");
})->save();
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>');