Config
Default framework configuration used by PhalconKit bootstraps.
The config is intentionally comprehensive: it defines core paths, provider classes, modules, model mappings, default REST permissions, session/cache behavior, security settings, and integration defaults. Applications can merge their own config over this class, but should preserve the expected top-level keys because providers and modules read them by path.
- Full name:
\PhalconKit\Bootstrap\Config - Parent class:
\PhalconKit\Config\Config
Methods
defineConst
Define path/environment constants expected by legacy and generated code.
public defineConst(): void
Existing constants are never overwritten. Values are read from Env first and then fall back to conservative defaults relative to the current project root.
pdoMysqlAttribute
private static pdoMysqlAttribute(string $attribute, string $legacyAttribute): int
- This method is static. Parameters:
| Parameter | Type | Description |
|---|---|---|
$attribute | string | |
$legacyAttribute | string |
__construct
Merge default framework config with application-provided overrides.
public __construct(array<string,mixed> $data = [], bool $insensitive = false): mixed
The constructor calls defineConst() before building config so path constants are available while default provider/module/model arrays are prepared. $data is appended using the config merge strategy, allowing applications to override or extend framework defaults.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$data | array | Application overrides. |
$insensitive | bool | Whether config keys should be case-insensitive. |
Inherited methods
pathToArray
Resolve a config path and normalize the result to an array.
public pathToArray(string $path, array|null $defaultValue = null, string|null $delimiter = null): array|null
null is preserved so callers can distinguish a missing optional path from a configured scalar value. Native Phalcon config objects are converted through toArray(), and any other non-null value is cast to an array.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$path | string | Path understood by Phalcon's native path() method. |
$defaultValue | array|null | Default returned when the path is |
| missing. | ||
$delimiter | string|null | Optional path delimiter. |
Return Value:
Normalized array value, or null when the path resolves to null.
merge
Merge data into this config instance.
public merge(array|\Phalcon\Config\ConfigInterface $toMerge, bool $append = false): \Phalcon\Config\ConfigInterface
When $append is false, native Phalcon merge behavior is used. When $append is true, numeric-keyed values are appended while associative values are replaced recursively. This is useful for framework config fragments such as provider lists, permission features, and default seed data where applications need to extend list values instead of replacing the whole list.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$toMerge | array|\Phalcon\Config\ConfigInterface | Data to merge into this |
| config. | ||
$append | bool | Use PhalconKit append-aware merge semantics. |
Return Value:
The current mutated config instance.
Throws:
When append mode receives a value that cannot be converted to an array. - InvalidArgumentException
internalMergeAppend
Append-merge two arrays recursively.
final protected internalMergeAppend(array $source, array $target): array
Integer keys are appended to preserve list-style config fragments. String keys replace existing values unless both sides contain arrays, in which case the merge recurses.
- This method is final. Parameters:
| Parameter | Type | Description |
|---|---|---|
$source | array | Base config data. |
$target | array | Incoming config data. |
Return Value:
Merged config data.
getDateTime
Return a modified immutable date.
public getDateTime(string $modifier, \DateTimeImmutable|null $dateTime = null): \DateTimeImmutable
This helper keeps date-modifier config strongly typed in lifecycle and retention code. When no base date is provided, the current time is used.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$modifier | string | Date/time modifier accepted by |
DateTimeImmutable::modify(), such as -1 month or +7 days. | ||
$dateTime | \DateTimeImmutable|null | Optional base date. |
Return Value:
Modified date.
Throws:
If the modifier cannot be parsed. - DateMalformedStringException