PHPackages                             jrdev/mysql - 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. jrdev/mysql

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

jrdev/mysql
===========

MySQLi Wrapper for PHP

v1.0.0(8y ago)120MITPHPPHP &gt;=5.4

Since Jun 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jrobinsonc/mysql)[ Packagist](https://packagist.org/packages/jrdev/mysql)[ Docs](https://github.com/jrobinsonc/mysql/blob/master/README.md)[ RSS](/packages/jrdev-mysql/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

MySQLi wrapper for PHP.
=======================

[](#mysqli-wrapper-for-php)

[![Build Status](https://camo.githubusercontent.com/6ef13b9a348117389b7fa30f92cbb15a46e1aa8f67bea78165d21d2f893c2a06/68747470733a2f2f7472617669732d63692e6f72672f6a726f62696e736f6e632f6d7973716c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jrobinsonc/mysql)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/384b9b0e370d05dac2bda02ac1719358af1e40c48b73c7605a83ee98c133cec7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a726f62696e736f6e632f6d7973716c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jrobinsonc/mysql/?branch=master)[![Dependency Status](https://camo.githubusercontent.com/da658d51b0878af8df90c214ccc60ee3478a6492250306c97afe69b794f76043/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3539356261336232306662323466303036333739633666322f62616467652e7376673f7374796c653d666c61742d737175617265)](https://www.versioneye.com/user/projects/595ba3b20fb24f006379c6f2)

Requirements
------------

[](#requirements)

1. MySQL 5.5 or newer.
2. PHP 5.4 or newer.

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

[](#installation)

Install the latest version with:

```
$ composer require jrdev/mysql

```

How to use
----------

[](#how-to-use)

First, connect to a database:

```
$db = new \jrdev\MySQL('host', 'user', 'pass', 'database');
```

Next, prepare your data, and call the necessary methods.

### Generic query method

[](#generic-query-method)

This method accepts only one param, the SQL to execute.
And returns a jrdev\\MySQL\\Result object.

```
$query = $db->query('SELECT ...');
```

### A SELECT statement

[](#a-select-statement)

This method accepts:

1. `tableName`: The name of the table.
2. `fields`: *(Optional)* The fields you want to obtain in the result. Accepts array or string
3. `where`: *(Optional)* The where. Accepts array, string or intenger
4. `orderBy` *(Optional)* The order by.
5. `limit` *(Optional)* The limit.

Returns a jrdev\\MySQL\\Result object.

```
$query = $db->select('table_name', 'field1, field2');

if ($query)
{
    echo 'Num Rows: ', $query->num_rows, '';

    foreach ($query as $row)
    {
        echo $row['first_name'], '';
    }
}
else
{
    echo $db->error();
}

// The $where (third param) accepts array, string or integer:
$query = $db->select('table_name', 'field1', ['name' => 'Pepe']); // With array.
$query = $db->select('table_name', 'field1', 'name = "Pepe"'); // With string.
$query = $db->select('table_name', 'field1', 1); // With integer. In this case, the resulting sql for the "WHERE" is "id = 1".
```

### An INSERT statement

[](#an-insert-statement)

This method accepts:

1. `tableName`: The name of the table.
2. `fields`: The fields you want to insert.

Returns the ID of the inserted row, or FALSE on error.

```
$inserted_id = $db->insert('table_name', [
    'field1' => 'Value 1',
    'field2' => 2,
]);
```

### An UPDATE statement

[](#an-update-statement)

This method accepts:

1. `tableName`: The name of the table.
2. `fields`: The fields to update.
3. `where`: The where. Accepts array, string or intenger.
4. `limit` *(Optional)* The limit of rows to update.

Returns the number of affected rows, or FALSE on error.

```
// NOTE: The $where (third param) like the select method accepts array, string or integer.

$row = [
    'field1' => 'Value',
];

$updated_rows = $db->update('table_name', $row, ['id' => 58]); // With array.
$updated_rows = $db->update('table_name', $row, 'id=58'); // With string.
$updated_rows = $db->update('table_name', $row, 58); // With integer.
```

### A DELETE statement

[](#a-delete-statement)

This method accepts:

1. `tableName`: The name of the table.
2. `where`: The where. Accepts array, string or intenger.
3. `limit` *(Optional)* The limit of rows to delete.

Returns the number of affected rows, or FALSE on error.

```
// NOTE: The $where (second param) like the select method accepts array, string or integer.

$deleted_rows = $db->delete('table_name', ['id' => 58]); // With array.
$deleted_rows = $db->delete('table_name', 'id=58'); // With string.
$deleted_rows = $db->delete('table_name', 58); // With integer.
```

License
-------

[](#license)

Licensed under the [MIT licence](https://raw.github.com/jrobinsonc/mysql/master/LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 94.7% 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 ~16 days

Total

3

Last Release

3233d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15801?v=4)[Jose Robinson](/maintainers/jrobinsonc)[@jrobinsonc](https://github.com/jrobinsonc)

---

Top Contributors

[![jrobinsonc](https://avatars.githubusercontent.com/u/15801?v=4)](https://github.com/jrobinsonc "jrobinsonc (18 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

---

Tags

mysqlmysqliphpdatabasemysqlwrappermysqli

###  Code Quality

TestsCodeception

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jrdev-mysql/health.svg)

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

###  Alternatives

[sergeytsalkov/meekrodb

The Simple PHP/MySQL Library

341387.0k10](/packages/sergeytsalkov-meekrodb)[stefangabos/zebra_database

An advanced, compact and lightweight MySQL database wrapper library, built around PHP's MySQLi extension.

11812.0k](/packages/stefangabos-zebra-database)[go/db

Database library

6624.1k](/packages/go-db)[krugozor/database

PHP class library for simple, convenient, fast and safe work with MySql database, using PHP mysqli extension and imitation of prepared queries.

392.5k](/packages/krugozor-database)

PHPackages © 2026

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