PHPackages                             majenkotech/dbwrapper - 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. majenkotech/dbwrapper

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

majenkotech/dbwrapper
=====================

Simple MySQL db wrapper functions using PDO

v0.2.1(8y ago)049BSD3PHP

Since Jan 4Pushed 8y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (9)Used By (0)

Simple PDO MySQL Wrapper Class
==============================

[](#simple-pdo-mysql-wrapper-class)

This is a simple class for providing a simple API to the PDO MySQL database driver.

It relies on all tables in your database having a column called `id` which is typically a `serial` type (`bigint(20) unsigned auto_increment`). This column is used to select individual records within a table.

Usage
-----

[](#usage)

1. Create an object:

    $db = new \\Majenkotech\\DB("username", "password", "hostname", "database");
2. Execute a query with optional embedded arguments:

    $q = $db-&gt;query("SELECT name,size FROM something WHERE foo=:bar AND baz=:fod", array( "bar" =&gt; 23, "fod" =&gt; "beep" ) );
3. Use `$db->nextRecord($q)` to get successive record objects:

    while ($r = $db-&gt;nextRecord($q)) { print "$r-&gt;name is $r-&gt;size\\n"; }

Other useful functions
----------------------

[](#other-useful-functions)

- Insert a new record into a table:

    $id = $db-&gt;insert("tablename", array( "field1" =&gt; "value", "field2" =&gt; value, ... etc ... ));
- Get ID of last inserted record:

    $id = $db-&gt;id();
- Update a record in a table:

    $db-&gt;update("table", $id, array( "field1" =&gt; "value", "field2" =&gt; value, ... etc ... ));
- Select a record by ID:

    $r = $db-&gt;select("tablename", $id);
- Set a single value in a record in a table:

    $db-&gt;set("table", $id, "field", "value");

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Total

8

Last Release

2984d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e510ffaa7db4ee87725e8bef1976b0632bb769a4056f9b10ca54419ae1b15d2?d=identicon)[majenkotech](/maintainers/majenkotech)

---

Top Contributors

[![majenkotech](https://avatars.githubusercontent.com/u/3812892?v=4)](https://github.com/majenkotech "majenkotech (13 commits)")

### Embed Badge

![Health badge](/badges/majenkotech-dbwrapper/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k280.5M5.5k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k114.4M86](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k51.5M8.1k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k62.7M487](/packages/mongodb-mongodb)[spatie/laravel-translatable

A trait to make an Eloquent model hold translations

2.4k22.1M345](/packages/spatie-laravel-translatable)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.5k23.2M24](/packages/kirschbaum-development-eloquent-power-joins)

PHPackages © 2026

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