PHPackages                             mysql2i/mysql2i - 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. mysql2i/mysql2i

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

mysql2i/mysql2i
===============

A modern compatibility layer for mysql functions in newer PHP versions

02PHP

Since May 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/betosouzace/mysql2i)[ Packagist](https://packagist.org/packages/mysql2i/mysql2i)[ RSS](/packages/mysql2i-mysql2i/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Mysql2i
=======

[](#mysql2i)

A modern compatibility layer for mysql functions in newer PHP versions.

Overview
--------

[](#overview)

This library provides a bridge between the deprecated mysql extension and the newer mysqli extension, allowing legacy applications to work with newer PHP versions without rewriting all database code.

The Mysql2i library:

- Implements all mysql\_\* functions using mysqli
- Uses clean object-oriented design with SOLID principles
- Is modular and easy to extend
- Provides a simple drop-in solution for legacy projects

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

[](#installation)

### Via Composer

[](#via-composer)

```
composer require mysql2i/mysql2i:dev-main
```

The explicit version constraint is necessary until a stable release is published to Packagist.

### Manual Installation

[](#manual-installation)

1. Download or clone the repository
2. Include the bootstrap file after your application's autoloader:

```
require_once 'path/to/mysql2i/src/bootstrap.php';
```

Usage
-----

[](#usage)

Once installed and included, the library will automatically provide mysql\_\* function compatibility.

### Example

[](#example)

```
// Connect to database using old mysql_* functions
$connection = mysql_connect('localhost', 'username', 'password');
mysql_select_db('database_name', $connection);

// Run a query
$result = mysql_query("SELECT * FROM users");

// Process results as usual
while ($row = mysql_fetch_assoc($result)) {
    echo $row['name'] . "";
}

mysql_close($connection);
```

Architecture
------------

[](#architecture)

The library uses several design patterns:

1. **Adapter Pattern**: Adapts mysqli functionality to the mysql interface
2. **Facade Pattern**: Provides a simplified interface for the mysql functions
3. **Singleton Pattern**: Maintains a single connection manager instance
4. **Factory Pattern**: Creates and manages adapter instances

Publishing to Packagist
-----------------------

[](#publishing-to-packagist)

If you want to publish this package to Packagist for easier installation via Composer:

1. Create a repository on GitHub or another Git hosting service
2. Push the code to the repository
3. Go to
4. Submit your repository URL
5. Once approved, you can install it via Composer with `composer require mysql2i/mysql2i`

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

```
php tests/Mysql2iTest.php
```

### Creating a Release

[](#creating-a-release)

1. Update the version number in `composer.json`
2. Commit and push changes
3. Create a new release/tag in your Git repository
4. Packagist will automatically update the package information

License
-------

[](#license)

This library is released under the MIT License.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/23d388c1a6700cf86e4baa0409ad6b8b98fc54c2e011a8fa09a11e5e09923ab3?d=identicon)[betosouzace](/maintainers/betosouzace)

---

Top Contributors

[![alvesbeto](https://avatars.githubusercontent.com/u/84138249?v=4)](https://github.com/alvesbeto "alvesbeto (3 commits)")

### Embed Badge

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

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

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