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[3 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 today

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 84% 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

2335d 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.7k570.0M4.9k](/packages/doctrine-dbal)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5153.8M110](/packages/dibi-dibi)[aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

44231.2k4](/packages/aura-sqlschema)[delight-im/db

Safe and convenient SQL database access in a driver-agnostic way

49152.2k6](/packages/delight-im-db)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.1k8](/packages/popphp-pop-db)

PHPackages © 2026

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