fomadev/bridgesql

Universal PDO library supporting 10 DBMS.

Maintainers

Package info

github.com/fomadev/bridgesql

pkg:composer/fomadev/bridgesql

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

2.0.0 2026-04-21 20:56 UTC

This package is auto-updated.

Last update: 2026-04-21 21:02:29 UTC


README

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 and data type management.

License: MIT PHP Version

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.
  • Lightweight: No external dependencies required for basic operation.

Installation

Use Composer to install the library:

composer require fomadev/bridgesql

Supported DBMS

BridgeSQL facilitates connection to the following systems :

  1. MySQL

  2. MariaDB

  3. PostgreSQL

  4. SQLite (Local file)

  5. Microsoft SQL Server

  6. Oracle (OCI)

  7. IBM DB2

  8. Firebird

  9. Informix

  10. Sybase (SAP ASE)

Quick Use

Configuration

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

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

Query execution

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]);

// Retrieve all the lines
$users = $db->fetchAll("SELECT * FROM users WHERE status = ?", ["active"]);

// Insert data
$db->execute("INSERT INTO users (name, email) VALUES (?, ?)", ["Molengo", "fordi@fomadev.com"]);
$lastId = $db->lastInsertId();