Tuicha
Simple ORM for MongoDB (PHP and HHVM)., (*1)
Installing
This project is under heavy development, the APIs may change without any notice., (*2)
Tuicha can be installed with composer., (*3)
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., (*4)
Creating a conection
Tuicha::addConnection("tuicha_testsuite");
By default all conections to localhost, (*5)
If the MongoDB server is running in another machine it must be specified in the second argument., (*6)
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., (*7)
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., (*8)
TODO
- Write more documentation
- Add events support.