Contracts

SettingsInterface

v1.0.0

Read and write module settings stored in the Hub's dedicated settings table.

Methods

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

Retrieve a setting value by key, with an optional default.

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

Persist a setting value.

public function register(string $group, array $defaults): void

Register a group of settings with their default values.

public function all(string $group): array

Retrieve all settings for a group.

Example

settings-interface.php
$this->settings->register('my-module', [
    'enabled' => true,
    'api_key' => '',
    'sync_interval' => 3600,
]);

$enabled = $this->settings->get('enabled', false);
$this->settings->set('api_key', 'sk-...');