PHP code example of mr-luke / settings-manager

1. Go to this page and download the library: Download mr-luke/settings-manager 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/ */

    

mr-luke / settings-manager example snippets


'bags' => [
    'general' => [ // Given key is used as a Bag name
        'driver'   => 'database', // One of available drivers
        'cache'    => true, // Should be Cached
        'lifetime' => 60 // Cache lifetime in minutes
	],
],

'drivers' => [
    'database' => [
        'class'      => \Mrluke\Settings\Drivers\Database::class,
        'connection' => 'mysql',
        'table'      => 'settings',
    ],

    'json' => [
        'class' => \Mrluke\Settings\Drivers\Json::class,
        'path'  => base_path('storage/app/settings/'),
        'file'  => 'settings.json',
    ]
],

$value = Settings::register(string $key, $value, string $type);

$value = Settings::get(string $key, $default = null);

$value = Settings::set(string $key, $value);

Settings::forget(string $key);

$value = Settings::bag(string $name)->get(string $key, $default = null);

// Get index
settings(string $key);
// Set value
settings([string $key => $value]);
// Get instance and perform action
settings()->forget(string $key);
bash
php artisan vendor:publish