Skip to content

Commit 2d9e97a

Browse files
committed
Update readme
1 parent 0226588 commit 2d9e97a

File tree

1 file changed

+35
-39
lines changed

1 file changed

+35
-39
lines changed

README.md

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,58 @@
1-
# PostgreSQL Client for Amp
1+
<p align="center">
2+
<a href="https://amphp.org/postgres"><img src="https://raw.githubusercontent.com/amphp/logo/master/repos/postgres.png?v=12-07-2017" alt="postgres"/></a>
3+
</p>
24

3-
This library is a component for [Amp](https://github.com/amphp/amp) that provides an asynchronous client for PostgreSQL.
5+
<p align="center">
6+
<a href="https://travis-ci.org/amphp/postgres"><img src="https://img.shields.io/travis/amphp/postgres/master.svg?style=flat-square" alt="Build Status"/></a>
7+
<a href="https://coveralls.io/github/amphp/postgres?branch=master"><img src="https://img.shields.io/coveralls/amphp/postgres/master.svg?style=flat-square" alt="Code Coverage"/></a>
8+
<a href="https://github.com/amphp/postgres/releases"><img src="https://img.shields.io/github/release/amphp/postgres.svg?style=flat-square" alt="Release"/></a>
9+
<a href="https://github.com/amphp/postgres/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="License"/></a>
10+
</p>
411

5-
[![Build Status](https://img.shields.io/travis/amphp/postgres/master.svg?style=flat-square)](https://travis-ci.org/amphp/postgres)
6-
[![Coverage Status](https://img.shields.io/coveralls/amphp/postgres/master.svg?style=flat-square)](https://coveralls.io/r/amphp/postgres)
7-
[![Semantic Version](https://img.shields.io/github/release/amphp/postgres.svg?style=flat-square)](http://semver.org)
8-
[![MIT License](https://img.shields.io/packagist/l/amphp/postgres.svg?style=flat-square)](LICENSE)
9-
[![@amphp on Twitter](https://img.shields.io/badge/twitter-%40asyncphp-5189c7.svg?style=flat-square)](https://twitter.com/asyncphp)
12+
<p align="center"><strong>Async PostgreSQL client built with <a href="https://amphp.org/">Amp</a>.</strong></p>
1013

11-
##### Requirements
14+
## Installation
1215

13-
- PHP 7+
14-
- [ext-pgsql](https://secure.php.net/pgsql) or [pecl-pq](https://pecl.php.net/package/pq)
15-
16-
##### Installation
17-
18-
The recommended way to install is with the [Composer](http://getcomposer.org/) package manager. (See the [Composer installation guide](https://getcomposer.org/doc/00-intro.md) for information on installing and using Composer.)
19-
20-
Run the following command to use this library in your project:
16+
This package can be installed as a [Composer](https://getcomposer.org/) dependency.
2117

2218
```bash
2319
composer require amphp/postgres
2420
```
2521

26-
You can also manually edit `composer.json` to add this library as a project requirement.
22+
## Requirements
2723

28-
```json
29-
// composer.json
30-
{
31-
"require": {
32-
"amphp/postgres": "^0.2"
33-
}
34-
}
35-
```
36-
37-
#### Example
38-
39-
```php
40-
#!/usr/bin/env php
41-
<?php
24+
- PHP 7.0+
25+
- [ext-pgsql](https://secure.php.net/pgsql) or [pecl-pq](https://pecl.php.net/package/pq)
4226

43-
require __DIR__ . '/vendor/autoload.php';
27+
## Documentation & Examples
4428

45-
use Amp\Postgres;
29+
More examples can be found in the [`examples`](examples) directory.
4630

31+
```php
4732
Amp\Loop::run(function () {
48-
/** @var \Amp\Postgres\Connection $connection */
49-
$connection = yield Postgres\connect('host=localhost user=postgres dbname=test');
33+
/** @var \Amp\Postgres\Pool $pool */
34+
$pool = Amp\Postgres\pool("host=localhost user=postgres dbname=test");
5035

5136
/** @var \Amp\Postgres\Statement $statement */
52-
$statement = yield $connection->prepare('SELECT * FROM test WHERE id=$1');
53-
54-
/** @var \Amp\Postgres\TupleResult $result */
55-
$result = yield $statement->execute(1337);
37+
$statement = yield $pool->prepare("SELECT * FROM test WHERE id=$1");
5638

39+
/** @var \Amp\Postgres\ResultSet $result */
40+
$result = yield $statement->execute([1337]);
5741
while (yield $result->advance()) {
5842
$row = $result->getCurrent();
5943
// $row is an array (map) of column values. e.g.: $row['column_name']
6044
}
6145
});
6246
```
47+
48+
## Versioning
49+
50+
`amphp/postgres` follows the [semver](http://semver.org/) semantic versioning specification like all other `amphp` packages.
51+
52+
## Security
53+
54+
If you discover any security related issues, please email [`[email protected]`](mailto:[email protected]) instead of using the issue tracker.
55+
56+
## License
57+
58+
The MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information.

0 commit comments

Comments
 (0)