PHPackages                             bbrala/php7-mysql-shim - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. bbrala/php7-mysql-shim

Abandoned → [dshafik/php7-mysql-shim](/?search=dshafik%2Fphp7-mysql-shim)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

bbrala/php7-mysql-shim
======================

A PHP 7 shim for ext/mysql. Temporary which doesn't break old PHP's

1.0.0beta2(9y ago)015.2k[3 PRs](https://github.com/bbrala/php7-mysql-shim/pulls)MITPHPPHP &gt;=5.3.6

Since Jul 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/bbrala/php7-mysql-shim)[ Packagist](https://packagist.org/packages/bbrala/php7-mysql-shim)[ RSS](/packages/bbrala-php7-mysql-shim/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (13)Used By (0)

[![Build Status](https://camo.githubusercontent.com/d4b84bc4657ac1f920edfa6b5fd049b308a50aade5b5f40b56851ec9de711717/68747470733a2f2f7472617669732d63692e6f72672f6473686166696b2f706870372d6d7973716c2d7368696d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dshafik/php7-mysql-shim)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0ed310f42de17330cac30e8031b624737ae90ee5df6d7c2ea69036f0c6401944/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6473686166696b2f706870372d6d7973716c2d7368696d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dshafik/php7-mysql-shim/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/13098597cc6c31f775e0a193d8d1bd3940cfd33d18f72824adbadaac81a910c2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6473686166696b2f706870372d6d7973716c2d7368696d2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dshafik/php7-mysql-shim/?branch=master)

PHP 7 Shim for ext/mysql
========================

[](#php-7-shim-for-extmysql)

This library attempts to create a drop-in replacement for ext/mysql on PHP 7 using mysqli.

For the most part, it should *just work*.

Why You Shouldn't Use This Library
----------------------------------

[](#why-you-shouldnt-use-this-library)

This library is meant to be a *stop-gap*. It will be slower than using the native functions directly.

**You should switch to `ext/pdo_mysql` or `ext/mysqli`, and migrate to [prepared queries](http://php.net/manual/en/pdo.prepared-statements.php) to ensure you are securely interacting with your database.**

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

[](#installation)

To install, either add `dshafik/php7-mysql-shim` to your `composer.json`:

```
$ composer require dshafik/php7-mysql-shim
```

or, clone/download this repo, and include `lib/mysql.php` in your project.

Usage
-----

[](#usage)

When installed with composer, the library is included automatically.

Once the `lib/mysql.php` file is included, it will create `mysql_*` functions if they don't already exist. ***You may safely include the file in a PHP 5.3.6+ project***, it will do nothing if the mysql extension is already available.

Caveats
-------

[](#caveats)

- Calls to `is_resource()` and `get_resource_type()` on MySQL connections and results will fail as these are now their `mysqli` equivalents.
- Some errors are now from `ext/mysqli`, and others are `E_USER_WARNING` instead of `E_WARNING`.
- You must use the `mysqli.*` INI entries instead of `mysql.*` (e.g. `mysqli.default_user` instead of `mysql.default_user`)
- If no host, username, password parameter is provided when using the `mysql_*` functions, the default values from the corresponding `mysqli.*` settings from `php.ini` file will be used (e.g. `mysqli.default_host`, `mysqli.default_user`, `mysqli.default_pw`)

Alternatives
------------

[](#alternatives)

Instead of using this drop-in-replacement library you should consider refactoring your code from `mysql` to e.g. `mysqli`. This process can be automated with e.g.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 74% 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 ~260 days

Recently: every ~365 days

Total

7

Last Release

2087d ago

Major Versions

0.2.1 → 1.0.0beta12017-01-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8734305?v=4)[SWIS](/maintainers/swisnl)[@swisnl](https://github.com/swisnl)

---

Top Contributors

[![dshafik](https://avatars.githubusercontent.com/u/58074?v=4)](https://github.com/dshafik "dshafik (94 commits)")[![bbrala](https://avatars.githubusercontent.com/u/3294970?v=4)](https://github.com/bbrala "bbrala (7 commits)")[![philip](https://avatars.githubusercontent.com/u/42943?v=4)](https://github.com/philip "philip (5 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (4 commits)")[![eryx12o45](https://avatars.githubusercontent.com/u/6588960?v=4)](https://github.com/eryx12o45 "eryx12o45 (2 commits)")[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (2 commits)")[![ASA1-ET-JENKINS](https://avatars.githubusercontent.com/u/48315530?v=4)](https://github.com/ASA1-ET-JENKINS "ASA1-ET-JENKINS (2 commits)")[![sonnysavage](https://avatars.githubusercontent.com/u/5487663?v=4)](https://github.com/sonnysavage "sonnysavage (1 commits)")[![stefket](https://avatars.githubusercontent.com/u/1169903?v=4)](https://github.com/stefket "stefket (1 commits)")[![SwenVanZanten](https://avatars.githubusercontent.com/u/3099122?v=4)](https://github.com/SwenVanZanten "SwenVanZanten (1 commits)")[![techhead](https://avatars.githubusercontent.com/u/311112?v=4)](https://github.com/techhead "techhead (1 commits)")[![webysther](https://avatars.githubusercontent.com/u/750007?v=4)](https://github.com/webysther "webysther (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![gharlan](https://avatars.githubusercontent.com/u/330436?v=4)](https://github.com/gharlan "gharlan (1 commits)")[![mekras](https://avatars.githubusercontent.com/u/192067?v=4)](https://github.com/mekras "mekras (1 commits)")[![mgilfillan](https://avatars.githubusercontent.com/u/25685838?v=4)](https://github.com/mgilfillan "mgilfillan (1 commits)")[![mlocati](https://avatars.githubusercontent.com/u/928116?v=4)](https://github.com/mlocati "mlocati (1 commits)")[![muhammedalialat](https://avatars.githubusercontent.com/u/8521941?v=4)](https://github.com/muhammedalialat "muhammedalialat (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/bbrala-php7-mysql-shim/health.svg)

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

PHPackages © 2026

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