pahenrus/react-mysqli

Asynchronous & non-blocking MySQL driver for React.PHP

Maintainers

Package info

github.com/pahenrus/react-mysqli

pkg:composer/pahenrus/react-mysqli

Statistics

Installs: 198

Dependents: 0

Suggesters: 0

Stars: 1

1.0.5 2018-02-19 09:51 UTC

This package is not auto-updated.

Last update: 2026-03-29 01:40:05 UTC


README

Asynchronous & non-blocking MySQLi driver for React.PHP.

Require php-mysqlnd extension

Install

composer require pahenrus/react-mysqli

Example

$loop = \React\EventLoop\Factory::create();

$makeConnection = function () {
    return mysqli_connect('localhost', 'vagrant', '', 'test');
};

$mysql = new \React\MySQLi\Client($loop, new \React\MySQLi\Pool($makeConnection, 10));

$mysql->query('select * from test')->then(
    function (\React\MySQLi\Result $result) {
        print_r($result->all());
    },
    function ($error) {
        error_log($error);
    }
);

$loop->run();