PHPackages                             degami/lessql - 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. degami/lessql

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

degami/lessql
=============

LessQL: The agile PHP ORM alternative

v0.4.1(7y ago)0207MITPHPPHP &gt;=5.3.4

Since Dec 18Pushed 8mo agoCompare

[ Source](https://github.com/degami/lessql)[ Packagist](https://packagist.org/packages/degami/lessql)[ Docs](https://github.com/morris/lessql)[ RSS](/packages/degami-lessql/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (3)Versions (15)Used By (0)

THIS IS JUST A COPY OF THE ORIGINAL PROJECT, WITH A CHANGE REQUEST THAT I'VE SUBMITTED TO THE AUTHOR ALREADY APPLIED
====================================================================================================================

[](#this-is-just-a-copy-of-the-original-project-with-a-change-request-that-ive-submitted-to-the-author-already-applied)

[go to the original project](https://github.com/morris/lessql)
--------------------------------------------------------------

[](#go-to-the-original-project)

LessQL
======

[](#lessql)

[![Build Status](https://camo.githubusercontent.com/6fbdfde092659a8f8a6ee6dafaec68e860f4cdfc4d68795ec5b468f01b1672ad/68747470733a2f2f7472617669732d63692e6f72672f6d6f727269732f6c657373716c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/morris/lessql)

LessQL is a lightweight and performant alternative to Object-Relational Mapping for PHP.

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

[](#installation)

Install LessQL via composer: `composer require degami/lessql`. LessQL requires PHP &gt;= 8.0 and PDO.

Usage
-----

[](#usage)

```
// SCHEMA
// user: id, name
// post: id, title, body, date_published, is_published, user_id
// categorization: category_id, post_id
// category: id, title

// Connection
$pdo = new PDO('sqlite:blog.sqlite3');
$db = new LessQL\Database($pdo);

// Find posts, their authors and categories efficiently:
// Eager loading of references happens automatically.
// This example only needs FOUR queries, one for each table.
$posts = $db->post()
	        ->where('is_published', 1)
	        ->orderBy('date_published', 'DESC');

foreach ($posts as $post) {
	$author = $post->user()->fetch();

	foreach ($post->categorizationList()->category() as $category) {
		// ...
	}
}

// Saving complex structures is easy
$row = $db->createRow('post', array(
	'title' => 'News',
	'body' => 'Yay!',
	'categorizationList' => array(
		array(
			'category' => array('title' => 'New Category')
		),
		array('category' => $existingCategoryRow)
	)
));

// Creates a post, a new category, two new categorizations
// and connects them all correctly.
$row->save();
```

Features
--------

[](#features)

- Efficient deep finding through intelligent eager loading
- Constant number of queries, no N+1 problems
- Save complex, nested structures with one method call
- Convention over configuration
- Work closely to your database: LessQL is not an ORM
- No glue code required
- Clean, readable source code
- Fully tested with SQLite3, MySQL and PostgreSQL
- MIT license

Inspired mainly by NotORM, it was written from scratch to provide a clean API and simplified concepts.

[Documentation and Examples](doc)
---------------------------------

[](#documentation-and-examples)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance43

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75.7% 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 ~133 days

Recently: every ~258 days

Total

13

Last Release

2572d ago

PHP version history (2 changes)v0.1-betaPHP &gt;=5.3.0

v0.3.4PHP &gt;=5.3.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/d03aa1b019b2ce33fea444b22e12336dc3128d9638493ddd3861328239bfff01?d=identicon)[degami](/maintainers/degami)

---

Top Contributors

[![morris](https://avatars.githubusercontent.com/u/32837?v=4)](https://github.com/morris "morris (87 commits)")[![degami](https://avatars.githubusercontent.com/u/2931478?v=4)](https://github.com/degami "degami (14 commits)")[![CQD](https://avatars.githubusercontent.com/u/94944?v=4)](https://github.com/CQD "CQD (5 commits)")[![palicao](https://avatars.githubusercontent.com/u/659961?v=4)](https://github.com/palicao "palicao (3 commits)")[![nataliawinter](https://avatars.githubusercontent.com/u/9592064?v=4)](https://github.com/nataliawinter "nataliawinter (1 commits)")[![cos800](https://avatars.githubusercontent.com/u/635184?v=4)](https://github.com/cos800 "cos800 (1 commits)")[![vikkio88](https://avatars.githubusercontent.com/u/248805?v=4)](https://github.com/vikkio88 "vikkio88 (1 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")[![luiz-brandao](https://avatars.githubusercontent.com/u/704231?v=4)](https://github.com/luiz-brandao "luiz-brandao (1 commits)")[![metala](https://avatars.githubusercontent.com/u/120106?v=4)](https://github.com/metala "metala (1 commits)")

---

Tags

databaseormsqlpdonotorm

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/degami-lessql/health.svg)

```
[![Health](https://phpackages.com/badges/degami-lessql/health.svg)](https://phpackages.com/packages/degami-lessql)
```

###  Alternatives

[morris/lessql

LessQL: A lightweight and performant PHP ORM alternative

405140.0k3](/packages/morris-lessql)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

101.6k](/packages/ramadan-easy-model)

PHPackages © 2026

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