1
0
mirror of https://github.com/danog/postgres.git synced 2024-12-02 17:37:57 +01:00
postgres/examples/basic.php
Aaron Piotrowski 0743e60583
WIP
2020-05-22 00:00:03 -05:00

21 lines
565 B
PHP

#!/usr/bin/env php
<?php
require \dirname(__DIR__) . '/vendor/autoload.php';
use Amp\Postgres;
Amp\Loop::run(function () {
$config = Postgres\ConnectionConfig::fromString('host=localhost user=postgres');
/** @var \Amp\Postgres\Connection $connection */
$connection = yield Postgres\connect($config);
/** @var \Amp\Postgres\ResultSet $result */
$result = yield $connection->query('SHOW ALL');
while ($row = yield $result->continue()) {
\printf("%-35s = %s (%s)\n", $row['name'], $row['setting'], $row['description']);
}
});