PHPackages                             kristuff/patabase - 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. kristuff/patabase

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

kristuff/patabase
=================

SQL query builder

v1.0.1(4y ago)61.2k1MITPHPPHP &gt;=7.1CI failing

Since Jun 30Pushed 4y ago2 watchersCompare

[ Source](https://github.com/kristuff/patabase)[ Packagist](https://packagist.org/packages/kristuff/patabase)[ Docs](https://patabase.kristuff.fr)[ RSS](/packages/kristuff-patabase/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (1)Versions (9)Used By (1)

[![logo](https://camo.githubusercontent.com/ca9dda4bc12caa7543b1c536af80d981c25393c0b06116165f66e9925a00a153/68747470733a2f2f70617461626173652e6b726973747566662e66722f696e632f696d672f6c6f676f2f6c6f676f2d7371756172652d34387834382e706e67)](https://camo.githubusercontent.com/ca9dda4bc12caa7543b1c536af80d981c25393c0b06116165f66e9925a00a153/68747470733a2f2f70617461626173652e6b726973747566662e66722f696e632f696d672f6c6f676f2f6c6f676f2d7371756172652d34387834382e706e67)Kristuff Patabase
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#kristuff-patabase)

A database/server SQL query builder for PHP.

[![Build Status](https://camo.githubusercontent.com/90c890d18aec23533b5adf178271cfd51d1baa4aa8944de774ab975accd1f0a2/68747470733a2f2f7472617669732d63692e636f6d2f6b726973747566662f70617461626173652e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/kristuff/patabase)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a3d7c953a0afb7b3d852d520e325dd1005315ae6c725ab86d18160420e286455/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b726973747566662f70617461626173652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kristuff/patabase/?branch=master)[![codecov](https://camo.githubusercontent.com/9070b15b2cfdb45c1ea35180bb12b4a3b0c8d39f431ef1dc374f570d5e2e6194/68747470733a2f2f636f6465636f762e696f2f67682f6b726973747566662f70617461626173652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/kristuff/patabase)[![Latest Stable Version](https://camo.githubusercontent.com/c09d5834cb87293cfea75fd8965028c4eab17b36e291886ae139910385a767a8/68747470733a2f2f706f7365722e707567782e6f72672f6b726973747566662f70617461626173652f762f737461626c65)](https://packagist.org/packages/kristuff/patabase)[![License](https://camo.githubusercontent.com/ce2d2831aa53cf6bf9cc6202f4ef2515f3794deab2c87c0412f71d1e873629f6/68747470733a2f2f706f7365722e707567782e6f72672f6b726973747566662f70617461626173652f6c6963656e7365)](https://packagist.org/packages/kristuff/patabase)

Website
-------

[](#website)

[patabase.kristuff.fr](https://patabase.kristuff.fr)

Features
--------

[](#features)

- Easy to use, easy to hack, fast and very lightweight
- Supported drivers: Sqlite, Mysql, Postgresql
- Requires only PDO
- Full [online documentation](https://patabase.kristuff.fr/doc)

SQL Features
------------

[](#sql-features)

Database queries:

```
- SELECT FROM:
    DISTINCT, all / column(s), columns(s)/alias, function(COUNT, SUM, MIN, MAX), sub select,
    JOIN        (INNER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN (*), FULL OUTER JOIN (*))
    WHERE       (=, !=, =, IN, NOT IN, NULL, NOT NULL),
    GROUP BY,
    HAVING      (COUNT, SUM),
    ORDER BY    (ASC, DESC, RAND (*)),
    LIMIT,
    OFFSET
- INSERT INTO
- DELETE FROM
    WHERE       (=, !=, =, IN, NOT IN, NULL, NOT NULL),
- UPDATE
    WHERE       (=, !=, =, IN, NOT IN, NULL, NOT NULL),
- CREATE TABLE (DEFAULT, PRIMARY KEYS, FOREIGN KEYS, NULL/NOT NULL)
- RENAME TABLE
- TABLE EXISTS
- SHOW TABLES
- DROP TABLE
- ENABLE FOREIGN KEY (*)
- DISABLE FOREIGN KEY (*)
- ADD FOREIGN KEY (*)
- DROP FOREIGN KEY (*)

```

Server queries (\*):

```
- CREATE DATABASE
- CREATE USER
- USER EXISTS
- DATABASE EXISTS
- SHOW USERS
- SWOW DATABASES
- GRANT USER
- DROP DATABASE
- DROP USER

```

(\*) some feature may be unavailable on some driver.

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

[](#requirements)

- PHP &gt;= 7.1
- PDO extension: Sqlite, Mysql or Postgresql

Sample of code
--------------

[](#sample-of-code)

```
$database = new \Kristuff\Patabase\Database(['driver' => 'sqlite', 'database' => '/somewhere/database.db']);
$database->select()
         ->column('customer.customerName')
         ->column('order.orderId')
         ->from('customer')
         ->innerJoin('order', 'customerId', 'customer', 'customerId')
         ->orderAsc('order.orderId')
         ->whereEqual('order.customerId', 222)
         ->getAll('json');
```

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2017-2022 Christophe Buliard

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~178 days

Total

7

Last Release

1543d ago

Major Versions

v0.5 → v1.02021-06-13

PHP version history (2 changes)v0.1PHP &gt;=5.6.0

v0.2PHP &gt;=7.1

### Community

Maintainers

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

---

Top Contributors

[![kristuff](https://avatars.githubusercontent.com/u/16272398?v=4)](https://github.com/kristuff "kristuff (129 commits)")

---

Tags

databasemysqlpdophppostgresqlquery-buildersqlsqlite

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kristuff-patabase/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

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

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198628.3k10](/packages/pgvector-pgvector)

PHPackages © 2026

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