CodeIgniter v4.7 API

Config extends BaseConfig
in package

Class BaseConfig

Tags
see
ConfigTest

Table of Contents

Properties

$override  : bool
Whether to override properties by Env vars and Registrars.
$registrars  : array<string|int, mixed>
An optional array of classes that will act as Registrars for rapidly setting config class properties.
$didDiscovery  : bool
Has module discovery completed?
$discovering  : bool
Is module discovery running or not?
$factory  : Database|null
The main instance used to manage all of our open database connections.
$instances  : array<string|int, mixed>
Cache for instance of any connections that have been requested as a "shared" instance.
$moduleConfig  : Modules|null
The modules configuration.
$registrarFile  : string
The processing Registrar file for error message.

Methods

__construct()  : mixed
Will attempt to get environment variables with names that match the properties of the child class.
__set_state()  : mixed
cleanupForWorkerMode()  : void
Cleanup database connections for worker mode.
connect()  : BaseConnection
Returns the database connection
forge()  : Forge
Loads and returns an instance of the Forge for the specified database group, and loads the group if it hasn't been loaded yet.
getConnections()  : array<string|int, mixed>
Returns an array of all db connections currently made.
reconnectForWorkerMode()  : void
Reconnect database connections for worker mode at the start of a request.
seeder()  : Seeder
Returns a new instance of the Database Seeder.
utils()  : BaseUtils
Returns a new instance of the Database Utilities class.
ensureFactory()  : void
Ensures the database Connection Manager/Factory is loaded and ready to use.
getEnvValue()  : string|null
Retrieve an environment-specific configuration setting
initEnvValue()  : void
Initialization an environment-specific configuration setting
parseEncryptionKey()  : string
Parse encryption key with hex2bin: or base64: prefix
registerProperties()  : void
Provides external libraries a simple way to register one or more options into a config file.

Properties

$override

Whether to override properties by Env vars and Registrars.

public static bool $override = true

$registrars

An optional array of classes that will act as Registrars for rapidly setting config class properties.

public static array<string|int, mixed> $registrars = []

$didDiscovery

Has module discovery completed?

protected static bool $didDiscovery = false

$discovering

Is module discovery running or not?

protected static bool $discovering = false

$factory

The main instance used to manage all of our open database connections.

protected static Database|null $factory

$instances

Cache for instance of any connections that have been requested as a "shared" instance.

protected static array<string|int, mixed> $instances = []

$moduleConfig

The modules configuration.

protected static Modules|null $moduleConfig

$registrarFile

The processing Registrar file for error message.

protected static string $registrarFile = ''

Methods

__construct()

Will attempt to get environment variables with names that match the properties of the child class.

public __construct() : mixed

The "shortPrefix" is the lowercase-only config class name.

__set_state()

public static __set_state(array<string|int, mixed> $array) : mixed
Parameters
$array : array<string|int, mixed>

cleanupForWorkerMode()

Cleanup database connections for worker mode.

public static cleanupForWorkerMode() : void

Rolls back any uncommitted transactions and resets transaction status to ensure a clean state for the next request.

Uncommitted transactions at this point indicate a bug in the application code (transactions should be completed before request ends).

Called at the END of each request to clean up state.

connect()

Returns the database connection

public static connect([array<string|int, mixed>|BaseConnection|non-empty-string|null $group = null ][, bool $getShared = true ]) : BaseConnection
Parameters
$group : array<string|int, mixed>|BaseConnection|non-empty-string|null = null

The name of the connection group to use, or an array of configuration settings.

$getShared : bool = true

Whether to return a shared instance of the connection.

Return values
BaseConnection

forge()

Loads and returns an instance of the Forge for the specified database group, and loads the group if it hasn't been loaded yet.

public static forge([array<string|int, mixed>|ConnectionInterface|string|null $group = null ]) : Forge
Parameters
$group : array<string|int, mixed>|ConnectionInterface|string|null = null
Return values
Forge

getConnections()

Returns an array of all db connections currently made.

public static getConnections() : array<string|int, mixed>
Return values
array<string|int, mixed>

reconnectForWorkerMode()

Reconnect database connections for worker mode at the start of a request.

public static reconnectForWorkerMode() : void

This should be called at the beginning of each request in worker mode, before the application runs.

seeder()

Returns a new instance of the Database Seeder.

public static seeder([non-empty-string|null $group = null ]) : Seeder
Parameters
$group : non-empty-string|null = null
Return values
Seeder

utils()

Returns a new instance of the Database Utilities class.

public static utils([array<string|int, mixed>|string|null $group = null ]) : BaseUtils
Parameters
$group : array<string|int, mixed>|string|null = null
Return values
BaseUtils

ensureFactory()

Ensures the database Connection Manager/Factory is loaded and ready to use.

protected static ensureFactory() : void

getEnvValue()

Retrieve an environment-specific configuration setting

protected getEnvValue(string $property, string $prefix, string $shortPrefix) : string|null
Parameters
$property : string
$prefix : string
$shortPrefix : string
Return values
string|null

initEnvValue()

Initialization an environment-specific configuration setting

protected initEnvValue(array<string|int, mixed>|bool|float|int|string|null &$property, string $name, string $prefix, string $shortPrefix) : void
Parameters
$property : array<string|int, mixed>|bool|float|int|string|null
$name : string
$prefix : string
$shortPrefix : string

parseEncryptionKey()

Parse encryption key with hex2bin: or base64: prefix

protected parseEncryptionKey(string $key) : string
Parameters
$key : string
Return values
string

registerProperties()

Provides external libraries a simple way to register one or more options into a config file.

protected registerProperties() : void
Tags
throws
ReflectionException

        
On this page

Search results