Contracts
SettingsInterface
v1.0.0Read and write module settings stored in the Hub's dedicated settings table.
Methods
public function get(string $key, mixed $default = null): mixedRetrieve a setting value by key, with an optional default.
public function set(string $key, mixed $value): voidPersist a setting value.
public function register(string $group, array $defaults): voidRegister a group of settings with their default values.
public function all(string $group): arrayRetrieve 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-...');