Heratio Framework API Reference

ConfigService
in package

Configuration service — wraps sfConfig for forward compatibility.

Reads from sfConfig now; provides the seam for future replacement when Symfony is eventually removed.

Usage: ConfigService::get('glam_type', 'archive'); ConfigService::getBool('enable_iiif', false); ConfigService::rootDir();

Table of Contents

Methods

all()  : array<string|int, mixed>
Get all configuration values.
assertBootRequirements()  : array<string|int, mixed>|null
Run boot-time assertions and return errors (if any).
get()  : mixed
Get a configuration value.
getArray()  : array<string|int, mixed>
Get an array configuration value.
getBool()  : bool
Get a boolean configuration value.
getInt()  : int
Get an integer configuration value.
has()  : bool
Check if a configuration key exists.
loadFromAppYaml()  : void
Load CSP and other settings from app.yml.
loadFromDatabase()  : void
Load settings from the database into sfConfig (or its shim).
parseDbConfig()  : array<string|int, mixed>|null
Parse database connection config from AtoM's config.php.
pluginsDir()  : string
Get the plugins directory.
renderBootErrorPage()  : string
Render a boot error page as standalone HTML.
rootDir()  : string
Get the AtoM root directory.
set()  : void
Set a configuration value.
uploadsDir()  : string
Get the uploads directory.

Methods

all()

Get all configuration values.

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

assertBootRequirements()

Run boot-time assertions and return errors (if any).

public static assertBootRequirements(string $rootDir) : array<string|int, mixed>|null

Checks:

  1. config/config.php exists and contains valid DB params
  2. Database is reachable (SELECT 1)
  3. Required tables exist
  4. uploads/ directory exists and is writable

Returns null on success, or a BootError object on failure.

Parameters
$rootDir : string
Return values
array<string|int, mixed>|null

get()

Get a configuration value.

public static get(string $key[, mixed $default = null ]) : mixed

Tries app_ prefixed key first (AtoM convention), then raw key.

Parameters
$key : string
$default : mixed = null

getArray()

Get an array configuration value.

public static getArray(string $key[, array<string|int, mixed> $default = [] ]) : array<string|int, mixed>
Parameters
$key : string
$default : array<string|int, mixed> = []
Return values
array<string|int, mixed>

getBool()

Get a boolean configuration value.

public static getBool(string $key[, bool $default = false ]) : bool
Parameters
$key : string
$default : bool = false
Return values
bool

getInt()

Get an integer configuration value.

public static getInt(string $key[, int $default = 0 ]) : int
Parameters
$key : string
$default : int = 0
Return values
int

has()

Check if a configuration key exists.

public static has(string $key) : bool
Parameters
$key : string
Return values
bool

loadFromAppYaml()

Load CSP and other settings from app.yml.

public static loadFromAppYaml(string $rootDir) : void

In Symfony mode, sfConfig loads app.yml automatically. In standalone mode, we parse it manually.

Parameters
$rootDir : string

loadFromDatabase()

Load settings from the database into sfConfig (or its shim).

public static loadFromDatabase([string $culture = 'en' ]) : void

Used in standalone mode (heratio.php) where QubitSettingsFilter isn't running. Replicates QubitSetting::getSettingsArray() logic.

Parameters
$culture : string = 'en'

parseDbConfig()

Parse database connection config from AtoM's config.php.

public static parseDbConfig(string $rootDir) : array<string|int, mixed>|null

This is the CANONICAL source for DB config parsing. Both bootstrap.php and Kernel::bootDatabase() should use this method.

Returns an array suitable for Illuminate Capsule::addConnection(), or null if the config file is missing/invalid.

Parameters
$rootDir : string
Return values
array<string|int, mixed>|null

pluginsDir()

Get the plugins directory.

public static pluginsDir() : string
Return values
string

renderBootErrorPage()

Render a boot error page as standalone HTML.

public static renderBootErrorPage(array<string|int, mixed> $error) : string

Returns a self-contained HTML page (no external dependencies) that displays the error with remediation steps.

Parameters
$error : array<string|int, mixed>
Return values
string

rootDir()

Get the AtoM root directory.

public static rootDir() : string
Return values
string

set()

Set a configuration value.

public static set(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

uploadsDir()

Get the uploads directory.

public static uploadsDir() : string
Return values
string

        
On this page

Search results