PHPackages                             gabbro-php/database - 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. gabbro-php/database

ActiveLibrary

gabbro-php/database
===================

Database library that unifies communications with multiple databases

1.006682(7mo ago)00MITPHP

Since Sep 28Pushed 7mo agoCompare

[ Source](https://github.com/gabbro-php/database)[ Packagist](https://packagist.org/packages/gabbro-php/database)[ RSS](/packages/gabbro-php-database/feed)WikiDiscussions gh-main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Gabbro - Database Library
=========================

[](#gabbro---database-library)

The **Gabbro Database Library** provides a lightweight, consistent abstraction layer over SQL databases.
It is designed to expose a **common set of interfaces** (`Connection`, `Statement`, `Cursor`) that can be reused across multiple database backends, while still giving developers access to features like typed placeholders and prepared statements.

Key Concepts
------------

[](#key-concepts)

- **Connection**
    Represents an open database connection.
    Provides methods to `execute()` statements, `query()` to return results, and `prepare()` to create reusable prepared statements.
- **Statement**
    A precompiled SQL statement created via `Connection::prepare()`.
    Statements can be executed or queried to return a `Cursor`.
- **Cursor**
    Provides iteration over a result set.
    Offers row navigation (`moveTo()`, `moveToNext()`), metadata (`getCount()`, `getColumnCount()`), and column value retrieval (`getColumn()`).

Placeholders
------------

[](#placeholders)

Queries use **custom placeholders** similar to `sprintf()` but adapted for SQL:

- `%s` → string
- `%i` → integer
- `%f` → float
- `%b` → blob

The library parses placeholders, replaces them with database-specific markers (e.g. `?` for SQLite), and binds values in a safe, type-aware way.

Current Implementation
----------------------

[](#current-implementation)

- **SQLite3** backend is included (`gabbro\\database\\sqlite3\\Connection`).
    Uses in-memory or file-based SQLite databases and fully supports the interfaces.

```
use gabbro\database\sqlite3\Connection;

$db = new Connection($file);
$cursor = $db->query("SELECT * FROM MyTable WHERE id > %i", 10);

while ($cursor->moveToNext()) {
    $name = $cursor->getColumn("username");
    ...
}
```

Goals
-----

[](#goals)

- Provide a unified API across different SQL backends.
- Ensure safe handling of placeholders and type conversions.
- Keep the design minimal, without hiding the underlying database’s capabilities.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance63

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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

Total

2

Last Release

224d ago

### Community

Maintainers

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

---

Top Contributors

[![dbergloev](https://avatars.githubusercontent.com/u/1395583?v=4)](https://github.com/dbergloev "dbergloev (12 commits)")

### Embed Badge

![Health badge](/badges/gabbro-php-database/health.svg)

```
[![Health](https://phpackages.com/badges/gabbro-php-database/health.svg)](https://phpackages.com/packages/gabbro-php-database)
```

PHPackages © 2026

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