PDO Connection Pool Config

PDO Connection Pool Config

  • Swoole\Database\PDOConfig->withHost
  • Swoole\Database\PDOConfig->withUnixSocket
  • Swoole\Database\PDOConfig->withPort
  • Swoole\Database\PDOConfig->withDbname
  • Swoole\Database\PDOConfig->withCharset
  • Swoole\Database\PDOConfig->withUsername
  • Swoole\Database\PDOConfig->withPassword
  • Swoole\Database\PDOConfig->withOptions

    Swoole\Database\PDOConfig->withHost(string $host)
    Swoole\Database\PDOConfig->withUnixSocket(string $unixSocket)
    Swoole\Database\PDOConfig->withPort(int $port)
    Swoole\Database\PDOConfig->withDbname(string $dbname)
    Swoole\Database\PDOConfig->withCharset(string $charset)
    Swoole\Database\PDOConfig->withUsername(string $username)
    Swoole\Database\PDOConfig->withPassword(string $withPassword)
    Swoole\Database\PDOConfig->withOptions(array $options)

    Example

    <?php
    (new PDOConfig())
        ->withHost(MYSQL_SERVER_HOST)
        ->withPort(MYSQL_SERVER_PORT)
        // ->withUnixSocket('/tmp/mysql.sock')
        ->withDbName(MYSQL_SERVER_DB)
        ->withCharset('utf8mb4')
        ->withUsername(MYSQL_SERVER_USER)
        ->withPassword(MYSQL_SERVER_PWD)