Last Updated: February 25, 2016
·
1.862K
· faulancer

MongoLite - NoSql implemented in Php (+Sqlite)

I needed a NoSql solution for small projects without the need of a full MongoDb server.

This is the result:

$client     = new MongoLite\Client(PATH_TO_WRITABLE_FOLDER);
$database   = $client->testdb;
$collection = $database->products;

$entry = ["name"=>"Super cool Product", "price"=>20];

$collection->insert($entry);

$products = $collection->find(); // Get Cursor

if ($products->count()) {

    foreach($products->sort(["price"=>1])->limit(5) as $product) {
        var_dump($product);
    }
}

More information + SourceCode: https://github.com/aheinze/MongoLite

Greets,
Artur

1 Response
Add your response

Artur, thanks for sharing. Congratulations on your achievement! Great idea with this implementation.
All the best to you.

over 1 year ago ·