/postgres

Async Postgres client for PHP based on Amp.

Primary LanguagePHPMIT LicenseMIT

postgres

Build Status Code Coverage Release License

Async PostgreSQL client built with Amp.

Installation

This package can be installed as a Composer dependency.

composer require amphp/postgres

Requirements

Documentation & Examples

More examples can be found in the examples directory.

Amp\Loop::run(function () {
    /** @var \Amp\Postgres\Pool $pool */
    $pool = Amp\Postgres\pool("host=localhost user=postgres dbname=test");

    /** @var \Amp\Postgres\Statement $statement */
    $statement = yield $pool->prepare("SELECT * FROM test WHERE id=$1");

    /** @var \Amp\Postgres\ResultSet $result */
    $result = yield $statement->execute([1337]);
    while (yield $result->advance()) {
        $row = $result->getCurrent();
        // $row is an array (map) of column values. e.g.: $row['column_name']
    }
});

Versioning

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

Security

If you discover any security related issues, please email contact@amphp.org instead of using the issue tracker.

License

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