1. Go to this page and download the library: Download gokure/hyperf-settings library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// Get the `default` store instance
setting();
// Get values
setting('foo');
setting('foo.bar');
setting('foo', 'default value');
setting()->get('foo');
// Set values
setting(['foo' => 'bar']);
setting(['foo.bar' => 'baz']);
setting()->set('foo', 'bar');
// Method chaining
setting(['foo' => 'bar'])->save();
return [
'default' => [
/**
* Default Store Driver
*
* This option controls the default setting connection that gets used while
* using this setting library.
*
* Supported: `FileSystemStore::class` and `DatabaseStore::class`
*/
'driver' => Gokure\Settings\FileSystemStore::class,
/**
* FileSystem Store
*
* This option used when the driver is set `FileSystemStore::class`, and
* make sure the path is writable.
*/
'path' => BASE_PATH . '/runtime/settings.json',
/**
* Database Store
*
* This option used when the driver is set DatabaseStore::class.
*/
'database' => [
// If set to null, the default connection will be used.
'connection' => null,
// Table name.
'table' => 'settings',
// Column names in database store.
'key_column' => 'key',
'value_column' => 'value',
],
],
];