DatabaseConfig
final class DatabaseConfig (View source)
Carries normalized connection settings independently of configuration source format.
Methods
Captures all connection options after their caller-selected defaults have been applied.
Normalizes an untrusted connection mapping into a validated immutable configuration.
Returns the selected connection driver family.
Returns the configured network host for network-capable drivers.
Returns the configured network port for network-capable drivers.
Returns the selected database or catalog name.
Returns the configured database login name.
Returns the configured database login secret.
Returns the connection character set requested from the driver.
Returns the optional collation requested after connection setup.
Returns the table-name prefix applied by driver-level identifier protection.
Indicates whether the connection should request strict SQL behavior where supported.
Indicates whether the driver may reuse a persistent physical connection.
Returns an explicitly configured dialect or the dialect implied by a concrete driver.
Returns an explicit DSN when it overrides host-based DSN construction.
Returns driver-specific connection options retained without framework interpretation.
Details
__construct
__construct(Driver $driver, string $host, int $port, string $database, string $username, string $password, string $charset, string $collation = '', string $prefix = '', bool $strict = true, bool $persistent = false, DatabaseDialect|null $dialect = null, string|null $dsn = null, array $options = [])
Captures all connection options after their caller-selected defaults have been applied.
fromArray
static DatabaseConfig
fromArray(array $config)
Normalizes an untrusted connection mapping into a validated immutable configuration.
driver
Driver
driver()
Returns the selected connection driver family.
host
string
host()
Returns the configured network host for network-capable drivers.
port
int
port()
Returns the configured network port for network-capable drivers.
database
string
database()
Returns the selected database or catalog name.
username
string
username()
Returns the configured database login name.
password
string
password()
Returns the configured database login secret.
charset
string
charset()
Returns the connection character set requested from the driver.
collation
string
collation()
Returns the optional collation requested after connection setup.
prefix
string
prefix()
Returns the table-name prefix applied by driver-level identifier protection.
strict
bool
strict()
Indicates whether the connection should request strict SQL behavior where supported.
persistent
bool
persistent()
Indicates whether the driver may reuse a persistent physical connection.
dialect
DatabaseDialect|null
dialect()
Returns an explicitly configured dialect or the dialect implied by a concrete driver.
dsn
string|null
dsn()
Returns an explicit DSN when it overrides host-based DSN construction.
options
array
options()
Returns driver-specific connection options retained without framework interpretation.