Stars: 327
Forks: 60
Pull Requests: 43
Issues: 84
Watchers: 23
Last Updated: 2023-09-07 03:03:20
An async MySQL client for PHP, optimizing database interactions with efficient non-blocking capabilities. Perfect for responsive, high-performance applications.
License: Other
Languages: PHP, Shell
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 allows to dynamically query a server with multiple MySQL connections concurrently.
The client transparently distributes these queries across a scalable pool of available connections and does so using 100% userland PHP; there are no external extension dependencies (e.g. ext/mysqli
, ext/pdo
, etc).
† As documented in official Mysql Internals Manual
This package can be installed as a Composer dependency.
composer require amphp/mysql
This package requires PHP 8.1 or later.
More extensive code examples reside in the examples
directory.
$config = Amp\Mysql\MysqlConfig::fromString(
"host=127.0.0.1 user=username password=password db=test"
);
$pool = new Amp\Mysql\MysqlConnectionPool($config);
$statement = $pool->prepare("SELECT * FROM table_name WHERE id = :id");
foreach ($statement->execute(['id' => 1337]) as $row) {
// $row is an associative array of column values. e.g.: $row['column_name']
}
amphp/mysql
follows the semver semantic versioning specification like all other amphp
packages.
If you discover any security related issues, please email [email protected]
instead of using the issue tracker.
The MIT License (MIT). Please see LICENSE
for more information.