PHP code example of daycry / settings

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

    

daycry / settings example snippets


$psr4 = [
    'Config'      => APPPATH . 'Config',
    APP_NAMESPACE => APPPATH,
    'App'         => APPPATH,
    'Daycry\Settings' => APPPATH .'ThirdParty/settings/src',
];

// The same as config('App')->siteName;
$siteName = service('settings')->get('App.siteName');

service('settings')->set('App.siteName', 'My Great Site');

service('settings')->forget('App.siteName')

helper('setting');

$name = setting('App.siteName');
// Store a value
setting('App.siteName', 'My Great Site');

// Using the service through the helper
$name = setting()->get('App.siteName');
setting()->set('App.siteName', 'My Great Site');

// Forgetting a value
setting()->forget('App.siteName');

service('settings')->set('App.siteName', null);
setting()->set('App.siteName', null);