1. Go to this page and download the library: Download khr/react-mysql library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
khr / react-mysql example snippets
$loop = React\EventLoop\Factory::create();
$makeConnection = function () {
return mysqli_connect('localhost', 'user', 'pass', 'dbname');
};
$mysql = new \KHR\React\Mysql\Client($loop, new \KHR\React\Mysql\Pool(function(){
return mysqli_connect('127.0.0.1', 'root', '', 'test');
}, 10));
$mysql->query('select * from ponies_and_unicorns')->then(
function ($result) { writeHttpResponse(json_encode($result->all())); },
function ($error) { writeHeader500(); }
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.