PHPackages                             jbboehr/zsql - 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. jbboehr/zsql

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

jbboehr/zsql
============

SQL generator loosely based on Zend\_Db\_Select

v0.7.2(9y ago)53.4k2[1 issues](https://github.com/jbboehr/zsql.php/issues)3MITPHPPHP &gt;=5.3.0

Since May 15Pushed 9y ago2 watchersCompare

[ Source](https://github.com/jbboehr/zsql.php)[ Packagist](https://packagist.org/packages/jbboehr/zsql)[ Docs](http://github.com/jbboehr/zsql.php)[ RSS](/packages/jbboehr-zsql/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (28)Used By (3)

zsql.php
========

[](#zsqlphp)

[![Build Status](https://camo.githubusercontent.com/7e11f6c06f714bded687a33f4657527624282b1d135acebf0628ef12f28ee0bc/68747470733a2f2f7472617669732d63692e6f72672f6a62626f6568722f7a73716c2e7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jbboehr/zsql.php)[![HHVM Status](https://camo.githubusercontent.com/945e2732fa88cbf8f09eb7e9696fcd0486f6e56912b1b248ae81ddfb592b97ee/687474703a2f2f6868766d2e683463632e64652f62616467652f6a62626f6568722f7a73716c2e7376673f7374796c653d666c6174)](http://hhvm.h4cc.de/package/jbboehr/zsql)[![Coverage Status](https://camo.githubusercontent.com/f8d46e9f88d204967296fcbbbc95dc252aeab6ea6e2fc7b76384b9ad51f60f23/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6a62626f6568722f7a73716c2e7068702f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/jbboehr/zsql.php?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/1351d2e1a2a01483dbd92ab6e8408296274a46c6f0dded41b53d4396fc5863b9/68747470733a2f2f706f7365722e707567782e6f72672f6a62626f6568722f7a73716c2f762f737461626c652e737667)](https://packagist.org/packages/jbboehr/zsql)[![License](https://camo.githubusercontent.com/3862397893ef289a05784f8f5c3369df1a3ece0000fe55f7460a0d72b09a15c0/68747470733a2f2f706f7365722e707567782e6f72672f6a62626f6568722f7a73716c2f6c6963656e73652e737667)](https://packagist.org/packages/jbboehr/zsql)

Lightweight MySQL adapter and SQL generator

Install
-------

[](#install)

Via Composer

```
composer require jbboehr/zsql
```

Usage
-----

[](#usage)

### Delete

[](#delete)

```
$database = new zsql\Adapter\MysqliAdapter($mysqli);
$database->delete()
  ->from('tableName')
  ->where('columnName', 'value')
  ->limit(1)
  ->query();
```

### Insert

[](#insert)

```
$database = new zsql\Adapter\MysqliAdapter($mysqli);
$id = $database->insert()
  ->ignore()
  ->into('tableName')
  ->value('columnName', 'value')
  ->value('otherColumnName', 'otherValue')
  ->query();
```

### Select

[](#select)

```
$database = new zsql\Adapter\MysqliAdapter($mysqli);
$rows = $database->select()
  ->from('tableName')
  ->where('columnName', 'value')
  ->order('orderColumn', 'ASC')
  ->limit(2)
  ->offset(5)
  ->query()
  ->fetchAll();
```

### Update

[](#update)

```
$database = new zsql\Adapter\MysqliAdapter($mysqli);
$database->update()
  ->table('tableName')
  ->set('columnName', 'value')
  ->set('someColumn', new zsql\Expression('NOW()'))
  ->where('otherColumnName', 'otherValue')
  ->limit(1)
  ->query();
```

### Basic SQL or Custom Database Adapter

[](#basic-sql-or-custom-database-adapter)

See [Adapters.md](https://github.com/jbboehr/zsql.php/blob/master/Adapters.md)

Testing
-------

[](#testing)

```
make test
```

License
-------

[](#license)

This project is licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity58

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

Recently: every ~31 days

Total

23

Last Release

3398d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3.0

0.8.x-devPHP &gt;=7.0

### Community

Maintainers

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

---

Top Contributors

[![jbboehr](https://avatars.githubusercontent.com/u/225601?v=4)](https://github.com/jbboehr "jbboehr (94 commits)")

---

Tags

phpsqlsql-generationgeneratormysqlsqldb

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jbboehr-zsql/health.svg)

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

###  Alternatives

[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4572.9M34](/packages/aura-sqlquery)[danielme85/laravel-log-to-db

Custom Laravel Log channel handler that can store log events to SQL or MongoDB databases. Uses Laravel native logging functionality.

135934.5k1](/packages/danielme85-laravel-log-to-db)[illuminated/db-profiler

Database Profiler for Laravel Web and Console Applications.

168237.4k](/packages/illuminated-db-profiler)[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

64401.8k10](/packages/rah-danpu)[atlas/query

Object-oriented query builders and performers for MySQL, Postgres, SQLite, and SQLServer.

41249.0k7](/packages/atlas-query)[aura/sqlschema

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

41234.1k4](/packages/aura-sqlschema)

PHPackages © 2026

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