Index Documentation

MariaDBConnectionInfo
in package
implements IDbConnectionInfo

Describes a MariaDB or MySQL connection.

Table of Contents

Interfaces

IDbConnectionInfo
Base type for database connection info.

Methods

__construct()  : MariaDBConnectionInfo
Creates an instance of MariaDBConnectionInfo.
create()  : MariaDBConnectionInfo
Tries to parse an end point string and creates a connection info instance using it.. Supports IPv4, IPv6 and DNS hostnames with and without a port number and Unix socket paths prefixed with unix://
createHost()  : MariaDBConnectionInfo
Creates a connection info instance with a hostname and port number.
createUnix()  : MariaDBConnectionInfo
Creates a connection info instance with a unix socket path.
getCertificateAuthorityPath()  : string|null
Returns the path to the certificate authority file to use for this connection.
getCertificatePath()  : string|null
Returns the path to the certificate to use for this connection.
getCharacterSet()  : string|null
Returns the default character set name.
getCipherAlgorithms()  : string|null
Returns the list of allowed SSL cipher algorithms.
getDatabaseName()  : string
Returns the connection default database name.
getEndPoint()  : EndPoint
Gets the end point value.
getHost()  : string
Gets the host value of the end point.
getInitCommand()  : string|null
Returns the initialisation command.
getKeyPath()  : string|null
Returns the path to the private key to use for this connection.
getPassword()  : string
Returns the connection user password.
getPort()  : int
Gets the port value of the end point.
getSocketPath()  : string
Gets the unix socket path.
getTrustedCertificatesPath()  : string|null
Returns the path to the trusted CA certificates directory for this connection.
getUserName()  : string
Returns the connection user name.
hasCharacterSet()  : bool
Whether this connection info carries a default character set name.
hasInitCommand()  : bool
Whether this connection info carries an initialisation command.
isSecure()  : bool
Whether SSL is to be used with the connection.
isUnixSocket()  : bool
Returns whether the end point is a unix socket path.
shouldUseCompression()  : bool
Whether compression should be applied on the connection.
shouldVerifyCertificate()  : bool
Whether the client should verify the validity of the server's certificate.

Methods

__construct()

Creates an instance of MariaDBConnectionInfo.

public __construct(EndPoint $endPoint, string $userName, string $password, string $dbName, string|null $charSet, string|null $initCommand, string|null $keyPath, string|null $certPath, string|null $certAuthPath, string|null $trustedCertsPath, string|null $cipherAlgos, bool $verifyCert, bool $useCompression) : MariaDBConnectionInfo
Parameters
$endPoint : EndPoint

End point at which the server can be found.

$userName : string

User name to use for the connection.

$password : string

Password with which the user authenticates.

$dbName : string

Default database name.

$charSet : string|null

Default character set.

$initCommand : string|null

Command to execute on connect.

$keyPath : string|null

Path at which to find the private key for SSL.

$certPath : string|null

Path at which to find the certificate file for SSL.

$certAuthPath : string|null

Path at which to find the certificate authority file for SSL.

$trustedCertsPath : string|null

Path at which to find the trusted SSL CA certificates for SSL in PEM format.

$cipherAlgos : string|null

List of SSL encryption cipher that are allowed.

$verifyCert : bool

true if the client should verify the server's SSL certificate, false if not.

$useCompression : bool

true if compression should be used, false if not.

Return values
MariaDBConnectionInfo

A connection info instance representing the given information.

create()

Tries to parse an end point string and creates a connection info instance using it.. Supports IPv4, IPv6 and DNS hostnames with and without a port number and Unix socket paths prefixed with unix://

public static create(string $endPoint, string $userName, string $password[, string $dbName = '' ][, string|null $charSet = null ][, string|null $initCommand = null ][, string|null $keyPath = null ][, string|null $certPath = null ][, string|null $certAuthPath = null ][, string|null $trustedCertsPath = null ][, string|null $cipherAlgos = null ][, bool $verifyCert = false ][, bool $useCompression = false ]) : MariaDBConnectionInfo
Parameters
$endPoint : string

End point string.

$userName : string

User name to use for the connection.

$password : string

Password with which the user authenticates.

$dbName : string = ''

Default database name.

$charSet : string|null = null

Default character set.

$initCommand : string|null = null

Command to execute on connect.

$keyPath : string|null = null

Path at which to find the private key for SSL.

$certPath : string|null = null

Path at which to find the certificate file for SSL.

$certAuthPath : string|null = null

Path at which to find the certificate authority file for SSL.

$trustedCertsPath : string|null = null

Path at which to find the trusted SSL CA certificates for SSL in PEM format.

$cipherAlgos : string|null = null

List of SSL encryption cipher that are allowed.

$verifyCert : bool = false

true if the client should verify the server's SSL certificate, false if not.

$useCompression : bool = false

true if compression should be used, false if not.

Return values
MariaDBConnectionInfo

A connection info instance representing the given information.

createHost()

Creates a connection info instance with a hostname and port number.

public static createHost(string $host, int $port, string $userName, string $password[, string $dbName = '' ][, string|null $charSet = null ][, string|null $initCommand = null ][, string|null $keyPath = null ][, string|null $certPath = null ][, string|null $certAuthPath = null ][, string|null $trustedCertsPath = null ][, string|null $cipherAlgos = null ][, bool $verifyCert = false ][, bool $useCompression = false ]) : MariaDBConnectionInfo
Parameters
$host : string

Server host name.

$port : int

Server port.

$userName : string

User name to use for the connection.

$password : string

Password with which the user authenticates.

$dbName : string = ''

Default database name.

$charSet : string|null = null

Default character set.

$initCommand : string|null = null

Command to execute on connect.

$keyPath : string|null = null

Path at which to find the private key for SSL.

$certPath : string|null = null

Path at which to find the certificate file for SSL.

$certAuthPath : string|null = null

Path at which to find the certificate authority file for SSL.

$trustedCertsPath : string|null = null

Path at which to find the trusted SSL CA certificates for SSL in PEM format.

$cipherAlgos : string|null = null

List of SSL encryption cipher that are allowed.

$verifyCert : bool = false

true if the client should verify the server's SSL certificate, false if not.

$useCompression : bool = false

true if compression should be used, false if not.

Return values
MariaDBConnectionInfo

A connection info instance representing the given information.

createUnix()

Creates a connection info instance with a unix socket path.

public static createUnix(string $path, string $userName, string $password[, string $dbName = '' ][, string|null $charSet = null ][, string|null $initCommand = null ][, string|null $keyPath = null ][, string|null $certPath = null ][, string|null $certAuthPath = null ][, string|null $trustedCertsPath = null ][, string|null $cipherAlgos = null ][, bool $verifyCert = false ][, bool $useCompression = false ]) : MariaDBConnectionInfo
Parameters
$path : string

Path to the unix socket.

$userName : string

User name to use for the connection.

$password : string

Password with which the user authenticates.

$dbName : string = ''

Default database name.

$charSet : string|null = null

Default character set.

$initCommand : string|null = null

Command to execute on connect.

$keyPath : string|null = null

Path at which to find the private key for SSL.

$certPath : string|null = null

Path at which to find the certificate file for SSL.

$certAuthPath : string|null = null

Path at which to find the certificate authority file for SSL.

$trustedCertsPath : string|null = null

Path at which to find the trusted SSL CA certificates for SSL in PEM format.

$cipherAlgos : string|null = null

List of SSL encryption cipher that are allowed.

$verifyCert : bool = false

true if the client should verify the server's SSL certificate, false if not.

$useCompression : bool = false

true if compression should be used, false if not.

Return values
MariaDBConnectionInfo

A connection info instance representing the given information.

getCertificateAuthorityPath()

Returns the path to the certificate authority file to use for this connection.

public getCertificateAuthorityPath() : string|null
Return values
string|null

Certificate authority file path.

getCertificatePath()

Returns the path to the certificate to use for this connection.

public getCertificatePath() : string|null
Return values
string|null

Certificate path.

getCharacterSet()

Returns the default character set name.

public getCharacterSet() : string|null
Return values
string|null

Default character set name.

getCipherAlgorithms()

Returns the list of allowed SSL cipher algorithms.

public getCipherAlgorithms() : string|null
Return values
string|null

Allowed SSL cipher algorithms.

getDatabaseName()

Returns the connection default database name.

public getDatabaseName() : string
Return values
string

Default database name.

getHost()

Gets the host value of the end point.

public getHost() : string

Will return an empty string if the end point is a unix socket path.

Return values
string

Target host name.

getInitCommand()

Returns the initialisation command.

public getInitCommand() : string|null
Return values
string|null

Initialisation command.

getKeyPath()

Returns the path to the private key to use for this connection.

public getKeyPath() : string|null
Return values
string|null

Private key path.

getPassword()

Returns the connection user password.

public getPassword() : string
Return values
string

Connection user password.

getPort()

Gets the port value of the end point.

public getPort() : int

Will return -1 if the end point is a unix socket path.

Return values
int

Target port number.

getSocketPath()

Gets the unix socket path.

public getSocketPath() : string

Will return an empty string if the end point is not a unix socket path.

Return values
string

Target unix socket path.

getTrustedCertificatesPath()

Returns the path to the trusted CA certificates directory for this connection.

public getTrustedCertificatesPath() : string|null
Return values
string|null

Trusted CA certificates directory path.

getUserName()

Returns the connection user name.

public getUserName() : string
Return values
string

Connection user name.

hasCharacterSet()

Whether this connection info carries a default character set name.

public hasCharacterSet() : bool
Return values
bool

true if it has a character set name, false if not.

hasInitCommand()

Whether this connection info carries an initialisation command.

public hasInitCommand() : bool
Return values
bool

true if it has an initialisation command, false if not.

isSecure()

Whether SSL is to be used with the connection.

public isSecure() : bool
Return values
bool

true if SSL should be used, false if not.

isUnixSocket()

Returns whether the end point is a unix socket path.

public isUnixSocket() : bool
Return values
bool

true if the end point is a unix socket, false if not.

shouldUseCompression()

Whether compression should be applied on the connection.

public shouldUseCompression() : bool

Only makes sense for remote connections, don't use this locally...

Return values
bool

true if compression should be used, false if not.

shouldVerifyCertificate()

Whether the client should verify the validity of the server's certificate.

public shouldVerifyCertificate() : bool
Return values
bool

true if the certificate should be verified, false if not.


        
On this page

Search results