tuicha/tuicha

There is no license information available for the latest version (v0.1.1) of this package.

v0.1.1 2016-12-20 05:10 UTC

README

Simple ORM for MongoDB (PHP and HHVM).

Installing

This project is under heavy development, the APIs may change without any notice.

Tuicha can be installed with composer.

composer require tuicha/tuicha:dev-develop

Getting started

Tuicha is designed to be simple and friendly with every framework, that is why it uses and abuses with static methods.

Creating a conection

Tuicha::addConnection("tuicha_testsuite");

By default all conections to localhost

If the MongoDB server is running in another machine it must be specified in the second argument.

Tuicha::addConnection("tuicha_testsuite", "mongodb://8.8.8.8:27017");

Defining models

Basic definition

Any object which uses the Tuicha\Document trait can be stored in MongoDB with Tuicha.

class Books {
  use Tuicha\Document;
}

$x = new Books;
$x->name = "foobar";
$x->save(); // save

var_dump($x->id); // Object ID

Any property (defined or not in the class definition) will be stored in MongoDB.

TODO

  1. Write more documentation
  2. Add events support.