PHPackages                             fatrbaby/knob - 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. fatrbaby/knob

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

fatrbaby/knob
=============

A simple, lightweight database query builder inspired by Laravel.

v0.6.0(1mo ago)02Apache-2.0PHPPHP &gt;= 8.2

Since May 27Pushed 3w agoCompare

[ Source](https://github.com/fatrbaby/knob)[ Packagist](https://packagist.org/packages/fatrbaby/knob)[ RSS](/packages/fatrbaby-knob/feed)WikiDiscussions main Synced 1w ago

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

Knob
====

[](#knob)

Knob is a simple, lightweight database query builder inspired by Laravel. It provides a fluent, chainable interface for building SQL queries across multiple database drivers.

Requirements
------------

[](#requirements)

- PHP 8.2+
- PDO extension

Supported Databases
-------------------

[](#supported-databases)

- MySQL / MariaDB
- PostgreSQL
- SQLite
- SQL Server

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

[](#installation)

```
composer require fatrbaby/knob
```

Quick Start
-----------

[](#quick-start)

```
use Knob\Knob;

// Set PDO connection (driver is auto-detected)
Knob::using($pdo);

// Build queries
$users = Knob::table('users')
    ->select('id', 'name', 'email')
    ->where('status', 'active')
    ->orderBy('created_at', 'DESC')
    ->limit(10)
    ->get();

// Insert
Knob::table('users')->insert([
    ['name' => 'Alice', 'email' => 'alice@example.com'],
]);

// Update
Knob::table('users')
    ->where('id', 1)
    ->update(['name' => 'Updated Name']);

// Delete
Knob::table('users')->where('id', 1)->delete();

// Aggregates
$count = Knob::table('users')->count();
```

OpenSpec
--------

[](#openspec)

This project uses OpenSpec for spec-driven changes.

- Workflow entry: `openspec/README.md`
- Baseline specs: `openspec/specs/`
- Active proposals: `openspec/changes/`

Testing
-------

[](#testing)

Run the default test suite:

```
make test
```

MySQL, PostgreSQL, and SQL Server smoke tests are optional and only run when their DSN environment variables are configured:

```
cp .env.example .env
```

Fill in the database credentials in `.env`, then run:

```
make smoke-mysql
make smoke-pgsql
make smoke-sqlsrv
```

Use `make smoke` to run all configured database smoke tests. Empty DSNs are skipped.

License
-------

[](#license)

Apache-2.0

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance92

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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 ~0 days

Total

2

Last Release

58d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4350262?v=4)[fatrbaby](/maintainers/fatrbaby)[@fatrbaby](https://github.com/fatrbaby)

---

Top Contributors

[![fatrbaby](https://avatars.githubusercontent.com/u/4350262?v=4)](https://github.com/fatrbaby "fatrbaby (28 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/fatrbaby-knob/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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