PHPackages                             agentejo/mongo-lite - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. agentejo/mongo-lite

ActiveLibrary[Database &amp; ORM](/categories/database)

agentejo/mongo-lite
===================

Schemaless database on top of SqLite

1.0.1(6y ago)1623.0k—0%17[2 issues](https://github.com/aheinze/MongoLite/issues)[1 PRs](https://github.com/aheinze/MongoLite/pulls)MITPHPPHP &gt;=5.4.2CI failing

Since Aug 28Pushed 5y ago7 watchersCompare

[ Source](https://github.com/aheinze/MongoLite)[ Packagist](https://packagist.org/packages/agentejo/mongo-lite)[ Docs](https://github.com/aheinze/MongoLite)[ RSS](/packages/agentejo-mongo-lite/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

MongoLite
=========

[](#mongolite)

Schemaless database on top of SqLite

### Sample Usage

[](#sample-usage)

```
$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);
    }
}
```

### Query collection

[](#query-collection)

In general you can use a callback or simple array as criteria

```
$collection->find(function($document) {   // recommended to query data
    return $document["price"] > 10;
});

//or

$collection->find(["price"=>['$gt'=>10]]); // only very simple criteria is supported (can be slow)

//or just one

$collection->findOne(function($document) { ... });
$collection->findOne([...]);
```

### Writing documents

[](#writing-documents)

```
$collection->insert($document);
$collection->save($document);
$collection->update($criteria, $data);
```

### Delete documents

[](#delete-documents)

```
$collection->remove($criteria);
```

\##API

**Client**

```
Client::listDBs()
Client::selectDB(databasename)
Client::selectCollection(databasename, collectionname)
```

**Database**

```
Database::vacuum()
Database::drop()
Database::createCollection(collectionname)
Database::dropCollection(collectionname)
Database::getCollectionNames()
Database::listCollections()
Database::selectCollection(collectionname)
```

**Collection**

```
Collection::drop()
Collection::renameCollection(newname)
Collection::insert(document)
Collection::save(document)
Collection::update(criteria, data)
Collection::remove(criteria)
Collection::count()
Collection::find(criteria)
Collection::findOne(criteria)
```

**Cursor**

```
Cursor::count()
Cursor::limit(number)
Cursor::skip(number)
Cursor::sort(array)
Cursor::each($callable)
Cursor::toArray()
```

Installation
------------

[](#installation)

To install and use MongoLite via the composer PHP package manager just take these steps:

If you don’t already have one, create the file composer.json in the root of your new project that is going to use MongoLite.

Add the following to the composer.json file..

```
{
    "require": {
        "agentejo/mongo-lite": "dev-master"
    }
}

```

Install composer (if it isn’t already installed):

```
curl -s https://getcomposer.org/installer | php
php composer.phar install

```

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1523 days

Total

2

Last Release

2383d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.2

1.0.1PHP &gt;=5.4.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/0139788f92cb114acf0ae3ea40c856e066d3afa9491413aedcc8a84086af2325?d=identicon)[faulancer](/maintainers/faulancer)

---

Top Contributors

[![aheinze](https://avatars.githubusercontent.com/u/321047?v=4)](https://github.com/aheinze "aheinze (24 commits)")[![faulancer](https://avatars.githubusercontent.com/u/8428?v=4)](https://github.com/faulancer "faulancer (10 commits)")[![charkes](https://avatars.githubusercontent.com/u/3394450?v=4)](https://github.com/charkes "charkes (3 commits)")[![nbpalomino](https://avatars.githubusercontent.com/u/1450270?v=4)](https://github.com/nbpalomino "nbpalomino (3 commits)")[![webcss](https://avatars.githubusercontent.com/u/1681683?v=4)](https://github.com/webcss "webcss (3 commits)")[![bassauer-storms-media](https://avatars.githubusercontent.com/u/25793506?v=4)](https://github.com/bassauer-storms-media "bassauer-storms-media (1 commits)")[![StevenDevooght](https://avatars.githubusercontent.com/u/449346?v=4)](https://github.com/StevenDevooght "StevenDevooght (1 commits)")

---

Tags

databasesqlitepdono-sqlschemaless

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/agentejo-mongo-lite/health.svg)

```
[![Health](https://phpackages.com/badges/agentejo-mongo-lite/health.svg)](https://phpackages.com/packages/agentejo-mongo-lite)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5656.7M231](/packages/nette-database)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5013.8M120](/packages/dibi-dibi)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4572.9M34](/packages/aura-sqlquery)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86946.7k](/packages/ezsql-ezsql)[jv2222/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

87311.3k2](/packages/jv2222-ezsql)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
