1. Go to this page and download the library: Download merodiro/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/ */
merodiro / settings example snippets
use Merodiro\Settings\HasSettings;
class User extends Model
{
use HasSettings;
...
}
// Global Settings
Settings::set('key', 'value');
Settings::set('key', 'another value');
// User Settings
$user->setSettings('key', 'value');
$user->setSettings('key', 'another value');
// Global Settings
$name = Settings::get('site-name');
$value = Settings::get('key', 'default');
// User Settings
$user->getSettings('site-name');
$user->getSettings('key', 'value');
// Global Settings
Settings::forget('key');
// User Settings
$user->forgetSettings('key');
// Global Settings
Settings::flush();
// User Settings
$user->flushSettings();
// Global Settings
$settings = Settings::all();
// User Settings
$settings = $user->allSettings();