PHPackages                             perritu/lean-db - 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. perritu/lean-db

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

perritu/lean-db
===============

A simple and light yet powerful ORM for PHP

v1.0.0(3mo ago)011↓80%UnlicensePHPPHP &gt;=8.5.0

Since Apr 2Pushed 2mo agoCompare

[ Source](https://github.com/Perritu/LeanDB)[ Packagist](https://packagist.org/packages/perritu/lean-db)[ Docs](https://github.com/Perritu/LeanDB)[ RSS](/packages/perritu-lean-db/feed)WikiDiscussions Main Synced 4w ago

READMEChangelogDependenciesVersions (3)Used By (0)

Perritu/LeanDB
==============

[](#perrituleandb)

A simple and light yet powerful ORM for PHP.

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

[](#installation)

The best way to install `LeanDB` is to use [Composer](https://getcomposer.org/):

```
composer require perritu/lean-db
```

Direct installation can be done, but it's not yet tested.

Usage
-----

[](#usage)

```
use Perritu\LeanDB\LeanDB;
use Perritu\LeanDB\Connection;
use Perritu\LeanDB\Model;

class MysqlCnn extends Connection
{
  protected static function GetCredentials(): string
  {
    $cUser     = getenv('MYSQL_USER');
    $cPassword = getenv('MYSQL_PASSWORD');
    $cHost     = getenv('MYSQL_HOST');
    $cPort     = getenv('MYSQL_PORT');
    $cDatabase = getenv('MYSQL_DATABASE');
    return "mysql://{$cUser}:{$cPassword}@{$cHost}:{$cPort}/{$cDatabase}";
  }
}

class User extends Model
{
  public const CONNECTION = MysqlCnn::class;
  public const TABLE = 'Users';
  public const FIELDS = [
    'User'     => [LeanDB::ID, null, null, 'User internal ID'],
    'Name'     => [LeanDB::VARCHAR, 30, null, 'User name'],
    'Email'    => [LeanDB::VARCHAR, 100, null, 'User email'],
    'Password' => [LeanDB::CHAR, 64, null, 'User password hash'],
    'Salt'     => [LeanDB::CHAR, 64, null, 'User password salt'],
  ];
  public const PERMS = LeanDB::PERM_ALL;
  public const SOFT_DELETES = true;
  public const TIMESTAMPS = true;
}

User::Create([
  'Name'     => 'John Doe',
  'Email'    => 'git@john.doe',
  'Password' => '4b57da426cca84945d79c2afa37635f0171674264ab03bfd81852e7342a70c56',
  'Salt'     => '0xd488d6befe35b869ccc4be07587846810cc175d488d6befe35b869ccc4be07',
])

$oPdoS = User::Read(['Email' => 'git@john.doe']);
if ($aUser = $oPdoS->fetch()) {
  $cExpectedPassword = $aUser['Password'];
  $cSalt = $aUser['Salt'];
  if (SecretPasswordGestor::Verify($cExpectedPassword, $cSalt)) {
    // ...
  }
}
```

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance84

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~12 days

Total

2

Last Release

78d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5545243?v=4)[Angel García](/maintainers/perritu)[@Perritu](https://github.com/Perritu)

---

Top Contributors

[![Perritu](https://avatars.githubusercontent.com/u/5545243?v=4)](https://github.com/Perritu "Perritu (32 commits)")

---

Tags

databaseormcrud

### Embed Badge

![Health badge](/badges/perritu-lean-db/health.svg)

```
[![Health](https://phpackages.com/badges/perritu-lean-db/health.svg)](https://phpackages.com/packages/perritu-lean-db)
```

###  Alternatives

[friendsofsymfony1/doctrine1

PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2

40685.2k](/packages/friendsofsymfony1-doctrine1)[flobbos/laravel-crudable

A Laravel package for saving time on crud operations

1615.2k](/packages/flobbos-laravel-crudable)[icanboogie/activerecord

ActiveRecord Object-relational mapping

125.1k5](/packages/icanboogie-activerecord)

PHPackages © 2026

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