百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

mysql

> 数据库
开源

一个用于 PHP 的异步 MySQL 客户端,可通过高效的非阻塞功能优化数据库交互。非常适用于响应速度快、性能高的应用程序。

377 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个用于 PHP 的异步 MySQL 客户端,可通过高效的非阻塞功能优化数据库交互。非常适用于响应速度快、性能高的应用程序。

amphp/mysql

AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind. amphp/mysql is an asynchronous MySQL client. The library implements concurrent querying by transparently distributing queries across a scalable pool of available connections. The MySQL client protocol is implemented using 100% PHP code; there are no external extension dependencies (e.g. ext/mysqli, ext/pdo, etc.).

Features

  • Exposes a non-blocking API for issuing multiple MySQL queries concurrently
  • Transparent connection pooling to overcome MySQL's fundamentally synchronous connection protocol
  • MySQL transfer encoding support (gzip, TLS encryption)
  • Support for parameterized prepared statements
  • Nested transactions with commit and rollback event hooks
  • Unbuffered results to reduce memory usage for large result sets
  • Full MySQL protocol support including all† available commands asynchronously

† As documented in official Mysql Internals Manual

Installation

This package can be installed as a Composer dependency.

bash
composer require amphp/mysql

Requirements

  • PHP 8.1+

Usage

More extensive code examples reside in the examples directory.

php
use Amp\Mysql\MysqlConfig;
use Amp\Mysql\MysqlConnectionPool;

$config = MysqlConfig::fromString(
    "host=localhost user=username password=password db=test"
);

$pool = new MysqlConnectionPool($config);

$statement = $pool->prepare("SELECT * FROM `table_name` WHERE `id` = :id");

$result = $statement->execute(['id' => 1337]);
foreach ($result as $row) {
    // $row is an associative-array of column values, e.g.: $row['column_name']
}

Versioning

amphp/mysql follows the semver semantic versioning specification like all other amphp packages.

Security

If you discover any security related issues, please use the private security issue reporter instead of using the public issue tracker.

License

The MIT License (MIT). Please see LICENSE for more information.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPamphpasyncmysqlphp

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库