You can also want to get latest stable version, so check out Downloads section. Stables are marked with tags including this library version and OrientDB version.

Using OrientDB-PHP

OrientDB-PHP uses autoload functionality, so you only need to include OrientDB.php file.

require 'OrientDB/OrientDB.php';

For a complex usage example see file example.php.

Testing OrientDB-PHP

OrientDB-PHP is covered with automatic tests by phpUnit. Tests are located in Tests/ directory.

You can always re-test the whole library by typing

phpunit Tests/

Don't forget to change root password BEFORE running tests.

Function list

Some functions requires to be already connected to OrientDB server (using connect()) or to have database opened (using DBOpen()). This can be referenced at protocol description. If sequence is wrong - exception OrientDBWrongCommandException will be thrown and no interaction with server will be made.

You can, however, use instance of class OrientDBRecord to create new entry in OrientDB server. If so, some of this instance properties (clusterID, recordPos, recordID, version) will be filled with correct values. See example below:

Due to PHP's behavior, objects are always passed by reference instead of int, for example. This, if automatically updating of record fields is not an option, can get you in trouble. So, in that case you should see example below:

You can, however, use instance of class OrientDBRecord to update record in OrientDB server. If so, some of this instance properties (clusterID, recordPos, recordID, version) will be filled with correct values. See example below:

Due to PHP's behavior, objects are always passed by reference instead of int, for example. This, if automatically updating of record fields is not an option, can get you in trouble. So, in that case you should see example below:

data - placeholder where data, deserialized from content, is stored. Developer should manipulate this data in applications.

For complete information on fields data types see PHPDoc in class.

At this point some class fields are public. Please, be careful.

However, class fields content, clusterID, recordPos, recordID and className are using magic methods. All of them are available for reading, while only fields content, clusterID, recordPos and className for writing.

OrientDBRecord Class methods

Class methods are:

parse() - can be called after maximum amount of fields was populated. Parses content and fill up fields data and className. Field recordPos are filled up automatically on setting recordID or clusterID via magic method __set().
In general, there is no need to call this method directly from user code, as record content is parsed automatically on request to any data or className fields. This is done via OrientDBRecordData class. This magic parsing only done once, until new content is assigned.

setParsed() - forces that record was already parsed.

__toString() - serialize back all fields from data. Return a string. Also can be called implicitly as type casting, e.g. (string) $record.