Services

Settings

v1.0.0

Default SettingsInterface implementation. Stores values in the Hub's meteorack_settings table with module-scoped keys.

Methods

public function get(string $key, mixed $default = null): mixed

Retrieve a setting with JSON decode support.

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

Persist a setting with automatic JSON encode for complex values.

Example

settings.php
// Declared in module.json:
// "services": ["settings"]

// Injected automatically:
public function __construct(
    private readonly SettingsInterface $settings,
) {}