Driver: PostgreSQL
The connection string can have special attributes to connect using SSL.
Connecting To PostgreSQL via SSL
<?php
$sslMode = "require"; // disable, allow, prefer, require, verify-ca, verify-full
$sslCert = "/path/to/client.crt"; // Path to client certificate file
$sslKey = "/path/to/client.key"; // Path to client private key file
$sslRootCert = "/path/to/ca.crt"; // Path to root CA certificate
$sslCrl = "/path/to/crl.pem"; // Path to certificate revocation list
$db = \ByJG\AnyDataset\Db\Factory::getDbInstance(
"postgresql://localhost/database?sslmode=$sslMode&sslcert=$sslCert&sslkey=$sslKey&sslrootcert=$sslRootCert&sslcrl=$sslCrl"
);
$iterator = $db->getIterator('select * from table where field = :value', ['value' => 10]);
foreach ($iterator as $row) {
// Do Something
// $row->getField('field');
}
SSL Mode Options
disable: SSL connection is not attemptedallow: SSL connection is attempted, but will connect without SSL if not availableprefer: SSL connection is attempted, but will connect without SSL if not available (default)require: SSL connection is requiredverify-ca: SSL connection is required and server certificate is verifiedverify-full: SSL connection is required, server certificate is verified and hostname is verified