2017 © Pedro Peláez
 

library async-mysql

Asynchronous & non-blocking MySQL driver for React.PHP

image

atrox/async-mysql

Asynchronous & non-blocking MySQL driver for React.PHP

  • Saturday, February 10, 2018
  • by kaja47
  • Repository
  • 6 Watchers
  • 43 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 17 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

AsyncMysql

Asynchronous & non-blocking MySQL driver for React.PHP., (*1)

Install

Add this crap to your composer.json:, (*2)

{
  "require": {
    "atrox/async-mysql": "dev-master"
  },
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/kaja47/async-mysql"
    }
  ]
}

Usage

Create instance of AsyncMysql and call method query. It returns Promise of mysqli_result that will be resolved imediately after query completes., (*3)

<?php

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

$makeConnection = function () {
  return mysqli_connect('localhost', 'user', 'pass', 'dbname');
};

$mysql = new Atrox\AsyncMysql($loop, $makeConnection);
$mysql->query('select * from ponies_and_unicorns')->then(
  function ($result) { writeHttpResponse(json_encode($result->fetch_all(MYSQLI_ASSOC))); $result->close(); },
  function ($error)  { writeHeader500(); }
);

The Versions

10/02 2018

dev-master

9999999-dev

Asynchronous & non-blocking MySQL driver for React.PHP

  Sources   Download

BSD-3-Clause

The Requires