1. Go to this page and download the library: Download jrschumacher/modomo library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jrschumacher / modomo example snippets
namespace Collections;
class Person {}
namespace Documents;
class Person {}
use Modomo\MongoClient;
use Documents\Person;
$m = new MongoClient();
$db = $m->test;
$coll = $db->person;
$bob = new Person(array(), $coll);
$bob->name = "Bob";
$bob->save();
$people = $coll->find();
$bob = $people->getNext();
$bob->getDoc; // array('name' => 'Bob', '_id' => array('$id' => '12345....'));
// To change the name space to \XYZ
Modomo\Config::$collectionNS = 'XYZ';
// To change the namespace to \XYZ\ABC
Modomo\Config::$collectionNS = 'XYZ\\ABC';
// To change the class name to XYZ (not a good idea)
Modomo\Config::$collectionClass = 'XYZ';
// To change the class name to AwesomePeopleCollection
Modomo\Config::$collectionClass = 'Awesome{{mongo.coll}}Collection';
namespace Collections;
class Person {}
$beforeSaveCallback = function() {};
Person::registerEvent('beforeSave', $beforeSaveCallback, array('param1', 'param2'));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.