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)18MITPHPPHP ^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 1mo ago

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

22

—

LowBetter than 22% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

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

644d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/521c2c04c593d94272f6b48881974dcaad13a01a82f2b7aaad60a251ab65a747?d=identicon)[rdanieli](/maintainers/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

[league/geotools

Geo-related tools PHP 7.3+ library

1.4k5.3M26](/packages/league-geotools)[clue/redis-react

Async Redis client implementation, built on top of ReactPHP.

28210.5M45](/packages/clue-redis-react)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

134391.5k12](/packages/rector-rector-src)[team-reflex/discord-php

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

1.1k379.4k24](/packages/team-reflex-discord-php)[react/mysql

Async MySQL database client for ReactPHP.

340421.0k29](/packages/react-mysql)[toin0u/geotools

Geo-related tools PHP 7.3+ library

1.4k1.3k](/packages/toin0u-geotools)

PHPackages © 2026

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