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

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

gelembjuk/db
============

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO

2.0.2(1y ago)01181MITPHP

Since Oct 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Gelembjuk/db)[ Packagist](https://packagist.org/packages/gelembjuk/db)[ RSS](/packages/gelembjuk-db/feed)WikiDiscussions master Synced 2d ago

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

Gelembjuk/DB package
--------------------

[](#gelembjukdb-package)

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO.

Use it to have simple and fast way to access a DB with an abstract layer. So you can change a DB engine later.

Currently only 2 engines are supported: mysql and mysqli (Gelembjuk\\DB\\MySQL and Gelembjuk\\DB\\MySQLi)

### Installation

[](#installation)

Using composer: [gelembjuk/db](http://packagist.org/packages/gelembjuk/db) `require: {"gelembjuk/db": "*"}`

### Usage

[](#usage)

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

// simple example to show how to work with 2 DB parelelly in a PHP script

$dbsettings1 = array(
	'user' => 'dbuser',
	'password' => 'dbuserpassword',
	'database' => 'mydb',
	'host' => 'localhost',
	'connectioncharset' => 'utf8',
	'namescharset' => 'utf8'
	);

// different DB
$dbsettings2 = array(
	'user' => 'dbuser',
	'password' => 'dbuserpassword',
	'database' => 'mydb2',
	'host' => 'localhost',
	'connectioncharset' => 'utf8',
	'namescharset' => 'utf8'
	);

$dbengine1 = new Gelembjuk\DB\MySQL($dbsettings1);
$dbengine2 = new Gelembjuk\DB\MySQLi($dbsettings2);
// connection will be established on a first request to a DB

class MyTable extends Gelembjuk\DB\Base {
	public function getUsers() {
		return $this->getRows('SELECT * FROM users');
	}
	public function addUser($name,$email) {
		$sql = "INSERT INTO users (name,email) VALUES ".
			"('".$this->quote($name)."','".$this->quote($email)."')";
		$this->executeQuery();

		return getLastInsertedId();
	}
}

$mytable = new MyTable($dbengine1);

$userid1 = $mytable->addUser('User 1','email@gmail.com');
$userid2 = $mytable->addUser('User 2','email2@gmail.com');

print_r($mytable->getUsers());

// this will do same but with different DB
$mytable2 = new MyTable($dbengine2);

print_r($mytable2->getUsers());
```

### Author

[](#author)

Roman Gelembjuk (@gelembjuk)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance43

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

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

Recently: every ~368 days

Total

10

Last Release

456d ago

Major Versions

1.1.0 → 2.0.12025-04-04

### Community

Maintainers

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

---

Top Contributors

[![Gelembjuk](https://avatars.githubusercontent.com/u/1552191?v=4)](https://github.com/Gelembjuk "Gelembjuk (15 commits)")

---

Tags

databasemysqlabstract database interface

### Embed Badge

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

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

###  Alternatives

[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

62414.3k11](/packages/rah-danpu)

PHPackages © 2026

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