PHPackages                             unreal4u/dbmysqli - 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. unreal4u/dbmysqli

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

unreal4u/dbmysqli
=================

A mysqli wrapper

v4.1.4(12y ago)132[1 issues](https://github.com/unreal4u/db_mysqli/issues)MITPHPPHP &gt;=5.3.0

Since Oct 5Pushed 2y agoCompare

[ Source](https://github.com/unreal4u/db_mysqli)[ Packagist](https://packagist.org/packages/unreal4u/dbmysqli)[ RSS](/packages/unreal4u-dbmysqli/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (6)Used By (0)

dbmysqli.php
============

[](#dbmysqliphp)

Important: deprecated
=====================

[](#important-deprecated)

Please don't use this code... like ever. WAY WAY WAAAAY better options exist nowadays. I'm archiving this repository as well.

Credits
-------

[](#credits)

This class is made by unreal4u (Camilo Sperberg). [http://unreal4u.com/](unreal4u.com). However, the initial idea isn't mine, so I would like to thank Mertol Kasanan, this class is based on his work. See  for details.

About this class
----------------

[](#about-this-class)

- It receives parametrized and simple SQL queries.
- It creates 3 arrays: one containing all data, and another one that contains some statistics. Optionally, it logs all errors into another array and also into an valid XML file.
- The DB connection made is singleton, that means only one connection is made for all your queries, even if you have more than 1 instance. The connection is established on demand, not when you initialize the class.

Detailed description
--------------------

[](#detailed-description)

This package implements a MySQL database access wrapper using the MySQLi extension.

There is class that manages MySQL database access connections so only one connection is established during the same PHP script execution.

Another class implements other database access functions like executing queries with prepared queries, measuring the time the queries take to execute and the memory usage, retrieving query results into arrays, the number of result rows, last inserted record identifier and log executed queries to a valid XML log file or directly into your page.

If the query takes just too long, you can cache the query result into an XML file, and you can also handle errors.

This package has been extensivily tested with xDebug, APC and Suhosin so that no errors are present.

Basic usage
-----------

[](#basic-usage)

```
include('src/unreal4u/config.php'); // Please see below for explanation
include('src/unreal4u/dbmysqli.php');
$dbLink = new unreal4u\dbmysqli();
$id_user = 23;
$username = 'unreal4u';
$aResult = $dbLink->query('SELECT id,username FROM users WHERE id = ? AND username = ?',$id_user,$username);
foreach($aResult AS $a) {
  echo 'The id of the user named '.$a['username'].' is: '.$a['id']."\n";
}
```

- Congratulations! `$aResult` has the result of your query!
- In case of large queries, don't forget to unset the results in order to save memory for later: `unset($aResult);`
- **Please see index.php for more options and advanced usage**

Including with composer
-----------------------

[](#including-with-composer)

Add this to your composer.json:

```
{
   "require": {
       "unreal4u/dbmysqli": "@stable"
   }
}
```

Now you can instantiate a new dbmysqli class by executing:

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

$rutverifier = new unreal4u\dbmysqli();
```

Pending ---------

- Multiquery support.
- Better naming convention to include other RDSMs later on
- Convert to PDO (to support :tag type associations)

Version History
---------------

[](#version-history)

- 4.0.0:

    - No longer is XML-based cache used, cacheManager class (see my other classes) is now in charge of doing all that job!
    - Better exception handling
- 4.0.1:

    - Support for multi-connections
    - Better documentation
    - Code cleanup and some minor improvements
- 4.1.0:

    - Made class compatible with composer.phar and PSR-0 autoloader standards
    - Some minor fixes in documentation and code
- 4.1.1:

    - Fixes
    - Better documentation
- 4.1.2:

    - Totally forgot about PSR-0 underscore standard. The class is now refactored to wipe out the usage of underscore in the class's name
- 4.1.3:

    - Better documentation
    - Year change
- 5.0.0:

    - Mayor revision of the code and several fixes, updated to comply with (at least) PSR-2
    - \[BC\] Result array is now an SplFixedArray, uses less memory and should be a bit faster as well
    - \[BC\] More types supported: float and DateTime objects are now returned for those type of data's
    - \[BC\] camelCase'd all methods and variables
    - \[BC\] Class now throws exceptions in it's proper namespace
        - unreal4u\\databaseException is now unreal4u\\exceptions\\database
        - unreal4u\\queryException is now unreal4u\\exceptions\\query
    - Fixed and updated documentation

Contact the author
------------------

[](#contact-the-author)

- Twitter: [@unreal4u](http://twitter.com/unreal4u)
- Website:
- Github:

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity62

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

Total

5

Last Release

4517d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/43792f8b224d7de339a848cd799635fa8e062eea3fb669e3ca7a1d1e2cff756d?d=identicon)[unreal4u](/maintainers/unreal4u)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/unreal4u-dbmysqli/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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