1. Go to this page and download the library: Download hema/mongo_transaction 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/ */
hema / mongo_transaction example snippets
use Hema\MongoTransaction\Transactions\Eloquent\Model
use use Jenssegers\Mongodb\Eloquent\Model
~$ sudo mongod --replSet "rs0"
~$ sudo mongo
use Hema\MongoTransaction\Transactions\Transaction
* Transaction::start();
// ........ A bunch of other db operations
* Transaction::commit();
// ........ commit when success
* Transaction::rollback();
// ........ Or rollback when error occure