• This repository has been archived on 05/Feb/2024
  • Stars
    star
    155
  • Rank 240,864 (Top 5 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 14 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A set of PHP libraries in order to use OrientDB from PHP

OrientDB PHP Library

Build Status Total Downloads Latest Stable Version

What's Orient?

A set of tools to use and manage any OrientDB instance from PHP.

Orient includes:

  • the HTTP protocol binding
  • the query builder
  • the data mapper ( Object Graph Mapper )

If you don't know OrientDB take a look at its Documentation.

After cloning

In order to be able to run the examples and the test suite provided by Orient, you must first enter the root of the cloned repository and initialize all the needed dependencies using Composer. We provide an utility script in the bin/ subdirectory to ease this process so you can just do the following:

$ ./bin/initialize-dependencies.sh

Current status of the binding

The binding is complete: it is an HTTP client wrapper with some methods bound to OrientDB's HTTP interface.

Its usage is straightforward:

$parameters = Doctrine\OrientDB\Binding\BindingParameters::create('http://admin:[email protected]:2480/demo');
$orient = new Doctrine\OrientDB\Binding\HttpBinding($parameters);
$output = $orient->query("SELECT FROM Address");

foreach ($output->getResult() as $address) {
    var_dump($address->street);
}

Use the PHP5.3 standard autoloader (https://gist.github.com/221634).

Current status of the query builder

The query-builder is finished, in the future we will consider the integration of OrientDB Graph Edition: http://code.google.com/p/orient/wiki/GraphEdTutorial.

To take advantage of the QB you only have to instantiate a Query object:

use Doctrine\OrientDB\Query\Query;

$query = new Query();
$query->from(array('users'))->where('username = ?', "admin");

echo $query->getRaw();      // SELECT FROM users WHERE username = "admin"

The Query object incapsulates lots of sub-commands, like SELECT, DROP, GRANT, INSERT and so on...

You can use also those commands:

use Doctrine\OrientDB\Query\Command\Select;

$select = new Select(array('users'));
echo $select->getRaw();     // SELECT FROM users

However, we strongly discourage this approach: commands will change, Query, thought as a facade, - hopefully - not.

You'd better take a look at the tests of the Query class and its subcommands to get a full overview of the available commands: in order to match OrientDB's native SQL-like synthax we tried to preserve names and stuff like that, but a few things have changed so far.

Current status of the mapper

We started working on the mapper and, right now, it is able to map OrientDB responses (converted in StdObject) to annotation-mapped POPOs. Also collections are hydrated properly.

However, it's under heavy work, so don't expect to be able to use it in a few weeks. Next steps are:

  • hydrate OrientDB native data-type (it includes floats, embedded-set|link|list, embedded-map|link|list and many others...)
  • provide a base repository class
  • implementation of the persistence from the ODM to OrientDB

Utilities

Orient incapsulates also a few utilities for PHP developers: on of them is an implementation of Dijkstra's algorithm.

use Doctrine\OrientDB\Graph\Graph;
use Doctrine\OrientDB\Graph\Vertex;
use Doctrine\OrientDB\Graph\Algorithm\Dijkstra;

$graph = new Graph();

$rome = new Vertex('Rome');
$paris = new Vertex('Paris');
$london = new Vertex('London');

$rome->connect($paris, 2);
$rome->connect($london, 3);
$paris->connect($london, 1);

$graph->add($rome);
$graph->add($paris);
$graph->add($london);

$algorithm = new Dijkstra($graph);
$algorithm->setStartingVertex($rome);
$algorithm->setEndingVertex($london);

var_dump($algorithm->solve());

Tests

The test suite can be launched simply by executing phpunit from the root directory of the repository.

By default the suite does not perform integration tests to verify the correct behaviour of our implementation against a running instance of OrientDB. Since integration tests are marked using the @group annotation, they can be enabled by default via phpunit.xml by adding a comment to the integration group in the list of excluded groups or, if you just want to execute them on a single execution basis, first load fixtures with this script

php ./test/Integration/fixtures/load.php

followeb by launching the suite with the additional --group argument:

phpunit --group __nogroup__,integration

It is also possible to generate a HTML report showing the code health of the library using PHP_CodeBrowser paired with the following dependencies (in addition to phpunit):

  • phpcpd
  • phpdcd
  • phploc
  • phpmd
  • phpdepend
  • phpcb

Executing ./bin/report.sh from the root directory of the repository will generate the report in log/report/index.html.

Requirements

These are the requirements in order to use the library:

  • PHP >= 5.3.3
  • OrientDB >= 1.2.0

In order to launch the test suite PHPUnit 3.6 is required.

Tracker & software lifecycle

See: https://github.com/doctrine/orientdb-odm/issues

Further documentation

If you want to take a look at a fancy PHPDoc documentation you can use doxygen:

sudo apt-get install doxygen

and then use the script provided under the docs directory:

doxygen docs/orient.d

which will generate technical documentation under the folder docs/html.

More Repositories

1

inflector

Doctrine Inflector is a small library that can perform string manipulations with regard to uppercase/lowercase and singular/plural forms of words.
PHP
11,213
star
2

lexer

Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
PHP
11,034
star
3

instantiator

PHP
10,924
star
4

orm

Doctrine Object Relational Mapper (ORM)
PHP
9,887
star
5

dbal

Doctrine Database Abstraction Layer
PHP
9,412
star
6

cache

Doctrine Cache component
PHP
7,810
star
7

annotations

Annotations Docblock Parser
PHP
6,731
star
8

event-manager

The Doctrine Event Manager is a library that provides a simple event system.
PHP
5,905
star
9

collections

Collections Abstraction Library
PHP
5,860
star
10

common

Doctrine Common
PHP
5,773
star
11

DoctrineBundle

Symfony Bundle for Doctrine ORM and DBAL
PHP
4,703
star
12

migrations

Doctrine Database Migrations Library
PHP
4,659
star
13

DoctrineMigrationsBundle

Symfony integration for the doctrine/migrations library
PHP
4,182
star
14

persistence

The Doctrine Persistence project is a library that provides common abstractions for object mapper persistence.
PHP
3,921
star
15

reflection

The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of the reflection API that comes with PHP. It allows you to get the reflection information about classes, methods and properties statically.
PHP
2,948
star
16

data-fixtures

Doctrine2 ORM Data Fixtures Extensions
PHP
2,769
star
17

DoctrineCacheBundle

Symfony2 Bundle for Doctrine Cache
PHP
2,750
star
18

DoctrineFixturesBundle

Symfony integration for the doctrine/data-fixtures library
PHP
2,446
star
19

sql-formatter

A lightweight php class for formatting sql statements. Handles automatic indentation and syntax highlighting.
HTML
1,646
star
20

deprecations

Thin library around different deprecation strategies
PHP
1,604
star
21

mongodb-odm

The Official PHP MongoDB ORM/ODM
PHP
1,085
star
22

mongodb

PHP MongoDB Abstraction Layer
PHP
442
star
23

DoctrineORMModule

Doctrine ORM Module for Laminas
PHP
436
star
24

DoctrineModule

Doctrine Module for Laminas
PHP
397
star
25

DoctrineMongoDBBundle

Integrates Doctrine MongoDB ODM with Symfony
PHP
377
star
26

coding-standard

The coding standard of the Doctrine project.
PHP
310
star
27

search

Generic Search extension for indexing and querying ODM/ORM objects with different text-search engine implementations
PHP
272
star
28

KeyValueStore

Abstraction for Key-Value to Plain Old PHP Object mapping
PHP
201
star
29

phpcr-odm

Doctrine PHPCR ODM
PHP
182
star
30

DoctrinePHPCRBundle

This bundle integrates Doctrine PHPCR ODM and PHPCR backends into Symfony
PHP
155
star
31

couchdb-odm

A Document Mapper based on CouchDB
PHP
150
star
32

doctrine2-orm-tutorial

Code for the ORM Tutorial
PHP
143
star
33

rest

Doctrine REST Server and Client Library
PHP
141
star
34

doctrine1

[Abandoned - please upgrade to Doctrine 2] Doctrine 1 Object Relational Mapper
PHP
132
star
35

couchdb-client

CouchDB Client library
PHP
122
star
36

skeleton-mapper

Doctrine Skeleton Object Mapper
PHP
101
star
37

orm-documentation

OUTDATED REPOSITORY - PLEASE MAKE PULL REQUESTS TO DOCTRINE2 REPOSITORY
Python
97
star
38

oxm

PHP Object to XML Mapping (OXM)
PHP
86
star
39

DoctrineMongoODMModule

Laminas Module for Doctrine MongoDB ODM
PHP
83
star
40

rst-parser

PHP
58
star
41

DoctrineCouchDBBundle

Symfony Bundle for DoctrineCouchDB
PHP
49
star
42

jira-github-issues

Scripts to migrate Jira to Github issues
PHP
38
star
43

mongodb-odm-softdelete

Soft delete functionality for the Doctrine MongoDB ODM
PHP
35
star
44

doctrine-laminas-hydrator

Doctrine hydrators for Laminas applications
PHP
33
star
45

doctrine1-documentation

Documentation for Doctrine 1
Python
30
star
46

doctrine-website

Source code for the doctrine-project.org website and documentation.
PHP
29
star
47

automatic-releases

Internal automatic release tool for doctrine/* projects
PHP
28
star
48

shards

Prototype sharding Extension for Doctrine
PHP
27
star
49

doctrine-website-sphinx

Sphinx-based Doctrine Website
CSS
18
star
50

doctrine-mongodb-odm-tailable-cursor-bundle

Doctrine MongoDB ODM Tailable Cursor Bundle
PHP
16
star
51

symfony-doctrine-static-website-generator

PHP
14
star
52

mongodb-odm-softdelete-bundle

Symfony2 bundle that integrates the Doctrine MongoDB ODM SoftDelete library.
PHP
14
star
53

dbal-documentation

MOVED TO DOCTRINE/DBAL REPOSITORY
Python
13
star
54

common-documentation

Documentation for the common Doctrine PHP extensions library.
Python
13
star
55

doctrine-zend-hydrator

Doctrine hydrators for Zend Framework applications
PHP
12
star
56

migrations-documentation

Documentation for the Doctrine Migrations
Python
12
star
57

.github

11
star
58

dbal-bundle

PHP
7
star
59

static-website-generator

Doctrine Static Website Generator
PHP
5
star
60

doctrine-website-build-prod

Generated website artifacts. See https://www.doctrine-project.org/contribute/website/
HTML
5
star
61

doctrine-build-common

Common Phing Build Scripts and Tasks for all Doctrine Projects
PHP
4
star
62

orm-benchmarking-suite

Suite to do functional ORM performance tests across versions
PHP
4
star
63

phpcr-odm-documentation

PHP Content Repository ODM Documentation
Python
4
star
64

couchdb-documentation

Documentation for Doctrine CouchDB ODM
Python
4
star
65

doctrine-sphinx-theme

Sphinx Theme for all Doctrine Documentations
CSS
4
star
66

DoctrineStaticWebsiteGeneratorBundle

DoctrineStaticWebsiteGeneratorBundle
PHP
2
star
67

vagrant-doctrine-website

Shell
1
star
68

jira-redirector

HTML
1
star
69

contributors-guide

A complete guide for Doctrine project collaborators and contributors.
1
star