PHPackages                             sumpygump/qi-db - 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. sumpygump/qi-db

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

sumpygump/qi-db
===============

Basic database adapter

1.3.0.1(1y ago)01381MITPHPPHP &gt;=5.3

Since Oct 8Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/sumpygump/qi-db)[ Packagist](https://packagist.org/packages/sumpygump/qi-db)[ Docs](https://quantalideas.com/code/qi-db)[ RSS](/packages/sumpygump-qi-db/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (5)Used By (1)

qi-db
=====

[](#qi-db)

Qi Db provides PHP library classes for running SQL on databases.

Installation with Composer
--------------------------

[](#installation-with-composer)

Use composer to include the `Qi\Db` library in a project.

```
composer require sumpygump/qi-db

```

If you don't have composer already installed, this is my recommendation for installing it. See [getcomposer.org installation instructions](http://getcomposer.org/doc/00-intro.md#globally).

Once the files have been composed with the `composer install` command, you can use any of the `Qi\Db` classes after composer's autoloader is included.

```
require 'vendor/autoload.php';

$db = new Qi\Db\PdoMysql();
// ...
```

Manual Installation
-------------------

[](#manual-installation)

You can also download the files and place them in a library folder. If you do this, be sure to update your autoloader to handle the `Qi_Db_*` classes or else manually include the files of the classes you'll need.

Basic Usage
-----------

[](#basic-usage)

This is some example code that illustrates connecting to a Mysql database:

```
$dbConfig = [
    'host' => 'localhost',
    'db'   => 'databasename',
    'user' => 'username',
    'pass' => 'mypassword',
];
$db = new Qi\Db\PdoMysql($dbConfig);

```

This is some example code that illustrates using the `insert()` and `fetchRow()`methods of the PdoMysql class.

```
// This will insert a new record into a `users` table
$newRow = [
    'email' => 'test@example.com',
    'first_name' => 'Joe',
    'last_name' => 'Schmoe',
];
$db->insert('users', $newRow);

// This will fetch a user by email address
$user = $db->fetchRow("SELECT * FROM `users` WHERE `email`=?", ['test@example.com']);

```

Please check the class source code for the full list of other methods that can be used.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance46

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

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

Total

3

Last Release

719d ago

### Community

Maintainers

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

---

Top Contributors

[![sumpygump](https://avatars.githubusercontent.com/u/676007?v=4)](https://github.com/sumpygump "sumpygump (10 commits)")

---

Tags

databasemysqlsqliteadapter

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sumpygump-qi-db/health.svg)

```
[![Health](https://phpackages.com/badges/sumpygump-qi-db/health.svg)](https://phpackages.com/packages/sumpygump-qi-db)
```

###  Alternatives

[cycle/database

DBAL, schema introspection, migration and pagination

71777.8k51](/packages/cycle-database)

PHPackages © 2026

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