1. Go to this page and download the library: Download sohris/reactphp-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/ */
sohris / reactphp-mysql example snippets
$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());
});