PHPackages                             terrafrost/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. [Database &amp; ORM](/categories/database)
4. /
5. terrafrost/php7-mysql-shim

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

terrafrost/php7-mysql-shim
==========================

A PHP 7 shim for ext/mysql

1.0.0beta2(9y ago)029.9k↓76.4%MITPHPPHP &gt;=5.3.6

Since Jul 4Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (7)Used By (0)

[![Build Status](https://camo.githubusercontent.com/d4b84bc4657ac1f920edfa6b5fd049b308a50aade5b5f40b56851ec9de711717/68747470733a2f2f7472617669732d63692e6f72672f6473686166696b2f706870372d6d7973716c2d7368696d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dshafik/php7-mysql-shim)[![Build status](https://camo.githubusercontent.com/e11c0d5ba5199be952d9a36372f8c03e0b0d28fa8e245debe28cbb554f40db6b/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f74766a3630763479336f306d6e3477703f7376673d74727565)](https://ci.appveyor.com/project/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)[![SensioLabsInsight](https://camo.githubusercontent.com/caa49a1b12f968a6ac7ef8d3fb1cc64e7f959437b217f6dc546d175bb6adb4d1/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34336332386535342d396334612d343062342d396363392d6436343039643738316464612f6d696e692e706e67)](https://insight.sensiolabs.com/projects/43c28e54-9c4a-40b4-9cc9-d6409d781dda)

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`)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75.6% 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 ~64 days

Total

4

Last Release

3459d ago

Major Versions

0.2.0 → 1.0.0beta12017-01-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/1214cf33299ce51f30c9c199cf3b55e8630cc16d5df714c551407088937e9988?d=identicon)[terrafrost](/maintainers/terrafrost)

---

Top Contributors

[![dshafik](https://avatars.githubusercontent.com/u/58074?v=4)](https://github.com/dshafik "dshafik (65 commits)")[![terrafrost](https://avatars.githubusercontent.com/u/214474?v=4)](https://github.com/terrafrost "terrafrost (5 commits)")[![philip](https://avatars.githubusercontent.com/u/42943?v=4)](https://github.com/philip "philip (5 commits)")[![ASA1-ET-JENKINS](https://avatars.githubusercontent.com/u/48315530?v=4)](https://github.com/ASA1-ET-JENKINS "ASA1-ET-JENKINS (2 commits)")[![eryx12o45](https://avatars.githubusercontent.com/u/6588960?v=4)](https://github.com/eryx12o45 "eryx12o45 (2 commits)")[![muhammedalialat](https://avatars.githubusercontent.com/u/8521941?v=4)](https://github.com/muhammedalialat "muhammedalialat (1 commits)")[![gharlan](https://avatars.githubusercontent.com/u/330436?v=4)](https://github.com/gharlan "gharlan (1 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (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)")[![sonnysavage](https://avatars.githubusercontent.com/u/5487663?v=4)](https://github.com/sonnysavage "sonnysavage (1 commits)")[![mekras](https://avatars.githubusercontent.com/u/192067?v=4)](https://github.com/mekras "mekras (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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