PHPackages                             fomadev/bridgesql - 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. fomadev/bridgesql

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

fomadev/bridgesql
=================

Universal PDO library supporting 10 DBMS.

2.0.2(5d ago)14proprietaryPHPPHP &gt;=8.0CI passing

Since Dec 31Pushed 5d agoCompare

[ Source](https://github.com/fomadev/bridgesql)[ Packagist](https://packagist.org/packages/fomadev/bridgesql)[ RSS](/packages/fomadev-bridgesql/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (6)Versions (8)Used By (0)

BridgeSQL v2.0.2
================

[](#bridgesql-v202)

**BridgeSQL** is a lightweight, universal PHP library designed to simplify the use of PDO. It acts as a robust bridge between your code and **10 different database management systems (DBMS)**, automating connection configuration, data type management, query debugging, and transaction safety.

[![Build Status](https://github.com/fomadev/bridgesql/actions/workflows/ci.yml/badge.svg)](https://github.com/fomadev/bridgesql/actions)[![License: FPL](https://camo.githubusercontent.com/f406d6ef915c0a7587f32b34b92a2984f8c5fb0d71ef44347a491684a72182a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d46504c2d6f72616e67652e737667)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/2b79fad0371c3700ef34ac5b759363f480a7785b68446f79c849d70badaa2ec9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344253230382e302d626c75652e737667)](https://www.php.net/)

Features
--------

[](#features)

- **Multi-DBMS Support**: A single interface for 10 SQL engines (MySQL, PostgreSQL, SQLite, Oracle, SQL Server, etc.).
- **Auto-Typing**: Automatic detection of PDO types (Integer, Boolean, String, Null) via PHP 8 `match`.
- **Parameter Flexibility**: Supports named (`:id`) and indexed (`?`) parameters.
- **Security**: Systematic use of prepared statements with emulation disabled for maximum security.
- **Logging &amp; Debugging**: Track execution time and view interpolated SQL queries for easier debugging.
- **Transaction Management**: Secure native handling of transactional states to prevent concurrency or duplicate initialization errors.
- **Lightweight**: No external dependencies required for basic operation.

Installation
------------

[](#installation)

Use [Composer](https://getcomposer.org/) to install the library:

```
composer require fomadev/bridgesql
```

Supported DBMS
--------------

[](#supported-dbms)

BridgeSQL facilitates connection to the following systems:

1. **MySQL** &amp; **MariaDB**
2. **PostgreSQL**
3. **SQLite** (Local file or `:memory:`)
4. **Microsoft SQL Server** (MSSQL)
5. **Oracle** (OCI)
6. **IBM DB2**
7. **Firebird**
8. **Informix**
9. **Sybase** (SAP ASE)

Quick Use
---------

[](#quick-use)

### Configuration

[](#configuration)

Create a configuration file (e.g., `config/database.php`):

```
return [
    'driver'   => 'mysql',
    'host'     => 'localhost',
    'dbname'   => 'my_database',
    'username' => 'root',
    'password' => '',
    'charset'  => 'utf8mb4'
];
```

### Query Execution &amp; Debugging

[](#query-execution--debugging)

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

use BridgeSQL\BridgeSQL;

$config = require 'config/database.php';
$db = new BridgeSQL($config);

// Retrieve a single line
$user = $db->fetch("SELECT * FROM users WHERE id = :id", ['id' => 1]);

// Insert data with auto-typing
$db->execute("INSERT INTO users (name, active) VALUES (?, ?)", ["Molengo", true]);

// --- Debugging Features (New in v2.0.1) ---

// Get the last executed query with parameters injected
echo $db->getLastQuery();
// Output: INSERT INTO users (name, active) VALUES ('Molengo', 1)

// Get full session logs (SQL, duration, and timestamp)
$logs = $db->getDebugLog();
print_r($logs);
```

### Transactions

[](#transactions)

```
$db->beginTransaction();

try {
    $db->execute("UPDATE accounts SET balance = balance - 100 WHERE id = 1");
    $db->execute("UPDATE accounts SET balance = balance + 100 WHERE id = 2");
    $db->commit();
} catch (Exception $e) {
    $db->rollBack();
    throw $e;
}
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.

License
-------

[](#license)

This project is licensed under the **FomaDev Public License (FPL)**.

- **Free** for use as a dependency in personal and commercial projects.
- **Paid** license required for redistribution, derivative libraries, or competing commercial services.

See the [LICENSE](LICENSE) file for the full text.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance95

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

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

Total

5

Last Release

5d ago

Major Versions

v1.0.4 → 2.0.02026-04-21

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/257554908?v=4)[FomaDev](/maintainers/fomadev)[@fomadev](https://github.com/fomadev)

---

Top Contributors

[![fordimalanda](https://avatars.githubusercontent.com/u/131183274?v=4)](https://github.com/fordimalanda "fordimalanda (37 commits)")

---

Tags

composerphp

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/fomadev-bridgesql/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/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

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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