1. Go to this page and download the library: Download alisaleem/laravel-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/ */
alisaleem / laravel-settings example snippets
namespace App;
class MySettings extends \AliSaleem\LaravelSettings\BaseSettings
{
public string $key;
public string $anotherKey = 'Default Value';
}
if (! function_exists('settings')) {
function settings(): \App\MySettings
{
return resolve(config('settings.class'));
}
}
// To retrieve a value
$value = resolve(\App\MySettings::class)->key;
$value = settings()->anotherKey;
// To set a value
resolve(\App\MySettings::class)->key = 'changed';
settings()->anotherKey = 'changed';