PHPackages                             makise-co/postgres - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. makise-co/postgres

ActiveLibrary[Database &amp; ORM](/categories/database)

makise-co/postgres
==================

A Pure coroutine PHP client for PostgreSQL based on libpq

v2.0.7(4y ago)66302MITPHPPHP &gt;=7.4CI failing

Since May 13Pushed 4y ago1 watchersCompare

[ Source](https://github.com/makise-co/postgres)[ Packagist](https://packagist.org/packages/makise-co/postgres)[ RSS](/packages/makise-co-postgres/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)Dependencies (5)Versions (27)Used By (2)

postgres-client
===============

[](#postgres-client)

A Pure PHP coroutine client for PostgreSQL based on libpq

Inspired by [amphp/postgres](https://github.com/amphp/postgres)

Installation
------------

[](#installation)

This package can be installed as a [Composer](https://getcomposer.org/) dependency.

```
composer require makise-co/postgres
```

Requirements
------------

[](#requirements)

- PHP 7.4+
- Swoole 4.4+
- [ext-pq](https://pecl.php.net/package/pq) for `PqConnection`
- ext-pgsql for `PgSqlConnection`
- [ext-swoole\_postgresql](https://github.com/swoole/ext-postgresql) for `SwooleConnection`

Supported underlying drivers
----------------------------

[](#supported-underlying-drivers)

DriverBuffered ModeUnbuffered ModeListenPostgres Arrays ConvertationPqYesYesYesYesPgSqlYesNoYesYesSwooleYesNoNoNoBenchmarks
----------

[](#benchmarks)

DriverTry 1Try 2Try 3SumPerformance vs PDOPDO PGSQL (raw)0.5948160.5880320.5972171.780065-Pq (buffered)0.6703690.6796730.6918902.041932-12.8245%Pq (unbuffered)1.2026171.2488771.2049003.656394-51.3164%PgSql0.8883120.8864940.8904772.665283-33.2129%Swoole0.6561560.6543180.6671541.977628-9.9899%Swoole (raw)0.5766670.5898550.5781051.744627+2.0313%Pq (raw)0.6432300.6451160.6563741.944720-8.4668%PgSql (raw)0.5761800.5831240.5777151.737019+2.4782%\* (raw) means that is a benchmark without any abstractions and PHP code execution.

\* The PgSql (raw) is much faster than Pgsql in this benchmark because there is no code to convert results to native PHP types.

All benchmarks can be found in the [`benchmark`](benchmark) directory.

Documentation &amp; Examples
----------------------------

[](#documentation--examples)

Prepared statements and parameterized queries support named placeholders, as well as `?` and standard numeric (i.e. `$1`) placeholders.

More examples can be found in the [`examples`](examples) directory.

```
