PHPackages                             15537773485/temporary-db-pgsql - 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. 15537773485/temporary-db-pgsql

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

15537773485/temporary-db-pgsql
==============================

0.0.1(3y ago)010MITPHPPHP &gt;=8.0

Since Aug 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/15537773485/temporary-db-pgsql)[ Packagist](https://packagist.org/packages/15537773485/temporary-db-pgsql)[ RSS](/packages/15537773485-temporary-db-pgsql/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

PgSQL driver for Hyperf DB Component
====================================

[](#pgsql-driver-for-hyperf-db-component)

安装
--

[](#安装)

> hyperf/db 组件版本必须大于等于 v2.1.8

```
composer require hyperf/db-pgsql-incubator

```

配置
--

[](#配置)

修改 `autoload/db.php` 配置

```
use Hyperf\DB\PgSQL\PgSQLPool;

return [
    'default' => [
        'driver' => PgSQLPool::class,
        'host' => '127.0.0.1',
        'port' => 5432,
        'database' => 'postgres',
        'username' => 'postgres',
        'password' => 'root',
        'pool' => [
            'min_connections' => 1,
            'max_connections' => 32,
            'connect_timeout' => 10.0,
            'wait_timeout' => 3.0,
            'heartbeat' => -1,
            'max_idle_time' => 60,
        ],
    ],
];
```

使用
--

[](#使用)

具体使用方式与 PDO 一致，只不过需要注意，`pgsql` 中的变量使用 `$1` 而不是 `?` 代表。

例如下述代码

```
