PHP code example of hyperf / db-pgsql-incubator

1. Go to this page and download the library: Download hyperf/db-pgsql-incubator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hyperf / db-pgsql-incubator example snippets



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,
        ],
    ],
];



use Hyperf\DB\DB;

$res = DB::query('SELECT * FROM USERS WHERE id = $1 AND nickname = $2;', [2, 'Hyperf']);