Config
extends BaseConfig
in package
Class Config
Tags
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 happened yet?
- $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.
Methods
- __construct() : mixed
- Will attempt to get environment variables with names that match the properties of the child class.
- __set_state() : mixed
- 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.
- seeder() : Seeder
- Returns a new instance of the Database Seeder.
- utils() : BaseUtils
- Returns a new instance of the Database Utilities class.
- ensureFactory() : mixed
- 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
- 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 happened yet?
protected
static bool
$didDiscovery
= 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
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>
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
BaseConnectionforge()
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
ForgegetConnections()
Returns an array of all db connections currently made.
public
static getConnections() : array<string|int, mixed>
Return values
array<string|int, mixed>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
Seederutils()
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
BaseUtilsensureFactory()
Ensures the database Connection Manager/Factory is loaded and ready to use.
protected
static ensureFactory() : mixed
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|nullinitEnvValue()
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
registerProperties()
Provides external libraries a simple way to register one or more options into a config file.
protected
registerProperties() : void