Download the PHP package fatrbaby/knob without Composer
On this page you can find all versions of the php package fatrbaby/knob. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fatrbaby/knob
More information about fatrbaby/knob
Files in fatrbaby/knob
Package knob
Short Description A simple, lightweight database query builder inspired by Laravel.
License Apache-2.0
Informations about the package 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
- PHP 8.3–8.x
- PDO extension and the driver required by your database
Supported Databases
| Database | PDO driver | Integration coverage |
|---|---|---|
| MySQL / MariaDB | pdo_mysql |
CI service database |
| PostgreSQL | pdo_pgsql |
CI service database |
| SQLite | pdo_sqlite |
Default local and CI test suite |
| SQL Server | pdo_sqlsrv |
CI service database |
Installation
Quick Start
Security
Knob binds values passed through structured query methods. SQL structure is a separate trust boundary:
- Raw methods such as
selectRaw(),whereRaw(),orWhereRaw(),groupByRaw(),havingRaw(), andorderByRaw()accept SQL fragments. Pass only trusted application code to them and, where a method accepts a bindings array, put data in that array.selectRaw()accepts no bindings, so its expression must contain no untrusted data. Never interpolate user input into a raw fragment. selectSub()also accepts a string overload. That string is inserted as a raw subquery and must therefore be trusted SQL without external data. Use aClosureorBuildersubquery when values need bindings.- Structured identifier arguments (for example table and column names) are quoted, but quoting is not authorization. Map user-facing sort, table, or column choices through an application-owned allowlist before calling Knob.
- Structured comparison methods accept only Knob's supported operator allowlist. If an operator comes from a request, map it to an allowed value; do not concatenate it into raw SQL.
OpenSpec
This project uses OpenSpec for spec-driven changes.
- Workflow entry:
openspec/README.md - Baseline specs:
openspec/specs/ - Active proposals:
openspec/changes/
Development
Install dependencies and run the same read-only quality gates used by CI:
composer ci performs strict package validation, formatting checks, PHPStan
Level 8 analysis, the Pest suite, and a dependency security audit. The Makefile
delegates to the same commands:
For local database smoke tests, copy the environment template and provide the credentials for the databases you have available:
Fill in the database credentials in .env, then run:
Use make smoke to run all configured database smoke tests. Empty non-SQLite
DSNs are skipped locally; CI supplies every DSN and treats any missing one as a
failure.
License
Licensed under the Apache License 2.0.
All versions of knob with dependencies
ext-pdo Version *