khr/react-mysql
最新稳定版本:v0.0.6
Composer 安装命令:
composer require khr/react-mysql
包简介
Asynchronous & non-blocking MySQL driver for React.PHP
README 文档
README
Asynchronous & non-blocking MySQL driver for React.PHP.
Install
Add this crap to your composer.json:
{
"require": {
"khr/react-mysql": "*"
}
}
Usage
Create instance of AsyncMysql and call method query.
It returns Promise of mysqli_result that will be resolved imediately after query completes.
<?php $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(); } );
统计信息
- 总下载量: 514
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: None
- 更新时间: 2015-04-11