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

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

sohris/reactphp-mysql
=====================

A ReactPHP-based repository for creating asynchronous and parallel connections to MySQL databases

0.1.1(1y ago)19MITPHPPHP ^8.0

Since Aug 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sohris/reactphp-mysql)[ Packagist](https://packagist.org/packages/sohris/reactphp-mysql)[ RSS](/packages/sohris-reactphp-mysql/feed)WikiDiscussions main Synced yesterday

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

Sohris ReactPHP Mysql
=====================

[](#sohris-reactphp-mysql)

[![Packagist Dependency Version](https://camo.githubusercontent.com/3808e5588867b9f83086888cb6fe9f040ebaa19a7e29c396461558b2876405d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f736f687269732f72656163747068702d6d7973716c2f706870)](https://camo.githubusercontent.com/3808e5588867b9f83086888cb6fe9f040ebaa19a7e29c396461558b2876405d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f736f687269732f72656163747068702d6d7973716c2f706870)[![Build](https://github.com/sohris/reactphp-mysql/actions/workflows/php.yml/badge.svg)](https://github.com/sohris/reactphp-mysql/actions/workflows/php.yml)[![Packagist Downloads](https://camo.githubusercontent.com/a085c41472fed2105e0ee7b62655c10190b04c6b19b91befb7b4a897bf48f028/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f687269732f72656163747068702d6d7973716c)](https://camo.githubusercontent.com/a085c41472fed2105e0ee7b62655c10190b04c6b19b91befb7b4a897bf48f028/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736f687269732f72656163747068702d6d7973716c)

ReactPHP MySQL is a package that provides an asynchronous connection to MySQL databases, enabling non-blocking execution for high-performance operations. Utilizing an event-driven model, it allows the creation of a connection pool, where multiple connection threads to the database are established. This enables parallel execution of scripts and queries, optimizing processing and operational efficiency.

Features
--------

[](#features)

- **Asynchronous Connections**: Non-blocking MySQL connections for enhanced performance.
- **Pool of Parallel Queries**: Execute multiple queries simultaneously to improve efficiency.

Install
-------

[](#install)

Using PHP Composer:

```
    compose require sohris/reactphp-mysql
```

Usage
-----

[](#usage)

### Simple usage

[](#simple-usage)

Create a single connection with database and execute a query.

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

$user = "user";
$password = "pass";
$host = "host";
$port = 3306;

//Create a new Connection
$connector = Sohris\Mysql\Connector\Factory::create($user, $password, $host, $port);

//Or
//Create a new lazy Connection
$connector = Sohris\Mysql\Connector\Factory::createLazyConnection($user, $password, $host, $port);

//Or
//To force a new connection, use a createLazyNewConnector
$connector = Sohris\Mysql\Connector\Factory::createLazyNewConnector($user, $password, $host, $port);

$connector->query("SELECT * FROM information_schema.ROUTINES Limit 1")
            ->then(function(Sohris\Mysql\Io\QueryResult $result){
                        var_dump($result->resultRows);
                    },
                    function(Exception $e){
                        var_dump($e->getMessage());
                    });
```

### Pool Usage

[](#pool-usage)

The Pool connection provides more connections to the database, allowing for parallel research in the database. Unlike simple usage, to execute a new query, use the exec method in the Pool class.

```
require __DIR__."/../vendor/autoload.php";

$user = "user";
$password = "pass";
$host = "host";
$port = 3306;

//Create a connection
$connector = new \Sohris\Mysql\Pool($user, $password, $host, $port);

$connector->exec("SELECT * FROM information_schema.ROUTINES Limit 1")
            ->then(function(Sohris\Mysql\Io\QueryResult $result){
                        echo "Result 1" . PHP_EOL;
                    },
                    function(Exception $e){
                        var_dump($e->getMessage());
                    });
```

To configure the maximum number of threads for database connections, use the setPoolSize method in the Pool class to set the limit.

```
$connector->setPoolSize(2);
```

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

690d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4098127?v=4)[Rafael Danieli](/maintainers/rdanieli)[@rdanieli](https://github.com/rdanieli)

---

Top Contributors

[![rodrigodanieli](https://avatars.githubusercontent.com/u/17441663?v=4)](https://github.com/rodrigodanieli "rodrigodanieli (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136406.3k14](/packages/rector-rector-src)[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k196.2M3.1k](/packages/composer-composer)[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M25.2k](/packages/friendsofphp-php-cs-fixer)[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

43.2k341.0k1](/packages/ccxt-ccxt)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k420.9k26](/packages/team-reflex-discord-php)[clue/redis-react

Async Redis client implementation, built on top of ReactPHP.

28316.2M47](/packages/clue-redis-react)

PHPackages © 2026

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