amphp/sql
Async SQL library for PHP built on Amp. Provides non-blocking database connections, query execution, and result handling with a consistent API, enabling high-concurrency apps without blocking I/O. Supports common drivers and integrates cleanly with event-loop workflows.
Full Changelog: https://github.com/amphp/sql/compare/v2.1.0...v2.1.1
"host=localhost port=5432 options='--client_encoding=UTF8'"Full Changelog: https://github.com/amphp/sql/compare/v2.0.1...v2.1.0
Full Changelog: https://github.com/amphp/sql/compare/v2.0.0...v2.0.1
Stable release compatible with AMPHP v3 and fibers! 🎉
As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.
Sql as a prefix to avoid name collisions with other libraries.ResultSet and CommandResult into a single interface, SqlResult.SqlTransaction now extends SqlLink instead of SqlExecutor to support nested transactions.onCommit() and onRollback() methods to SqlTransaction. These methods attach callbacks after the transaction is either committed or rolled back, respectively.createSavepoint(), rollbackTo(), and releaseSavepont() from SqlTransaction. Use nested transactions through SqlTransaction::beginTransaction() instead.SqlPool now extends SqlConnection instead of SqlLink. SqlPool::extractConnection() returns an instance of SqlConnection instead of SqlLink.SqlResult::fetchRow(), which will return a single row (associative array) from the result set on each call until no further rows remain in the result.SqlTransientResource and now extends Amp\Closable.SqlTransactionIsolation and an enum-based implementation, SqlTransactionIsolationLevel.ConnectionConfig to SqlConfig.FailureException to SqlException.Transaction interface now extends Link, adding nested transaction functionality through beginTransaction() on a transaction object.Connection interface with methods to retrieve the config and get/set the current transaction isolation.TransactionIsolation argument of Link::beginTransaction() has been removed. Transaction isolation is now set on the connection in the new Connection interface.Pool now extends Connection instead of Link. Pool::extractConnection() returns an instance of Connection instead of Link.SqlConnector::connect() returns an instance of Connection instead of Link.Transaction::getIsolationLevel() to getIsolation().createSavepoint(), rollbackTo(), and releaseSavepont() from Transaction. Use nested transactions through beginTransaction() instead.onCommit() and onRollback() methods to Transaction. These methods attach callbacks when the transaction is either committed or rolled back, respectively.Full Changelog: https://github.com/amphp/sql/compare/v2.0.0-beta.5...v2.0.0-beta.6
PoolErrornon-empty-string instead of stringResult::fetchRow(), which will return a single row (associative array) from the result set on each call until no further rows remain in the result.// Iterate over result rows with a simple while loop
while ($row = $result->fetchRow()) {
// ...
}
// Also useful if you know your result will contain only a single row
$id = $result->fetchRow()['id'] ?? throw new Exception('Item not found');
Amp\Sql\Pool.Initial release compatible with AMPHP v3.
As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.
TransientResource now extends Amp\ClosableTransactionIsolation and an enum-based implementation, TransactionIsolationLevelResultSet and CommandResult into a single interface, ResultConnectionConfig to SqlConfigConnector to SqlConnectorFailureException to SqlExceptionConnectionConfig::parseConnectionString() will now parse the port from the host, i.e.: host=localhost:3306 will return the array ['host' => 'localhost', 'port' => '3306'].Initial release.
How can I help you explore Laravel packages today?