Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 22.x
Latest version:
pecl install openswoole-22.1.2
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)
<?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)