PHP code example of skyline / settings

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

    

skyline / settings example snippets



use TASoft\Service\ServiceManager;
use Skyline\Setting\SettingManagerInterface;

$sm = ServiceManager::generalServiceManager()->get( SettingManagerInterface::SERVICE_NAME );
// or
$sm = ServiceManager::generalServiceManager()->get( "settingManager" );

// In an action controller method, just use:
$sm = $this->settingManager;


use Skyline\Setting\SettingManagerInterface;
/** @var SettingManagerInterface $sm */

$width = $sm->getSetting("width");


use Skyline\Setting\SettingManagerInterface;
/** @var SettingManagerInterface $sm */

// Declare width only in default scope
$sm->declareSetting('width', 250);

// Declare width only in group VIEW
$sm->declareSetting("width", 250, 'VIEW');

// Declare width only for USER_A
$sm->declareSetting("width", 250, NULL, 'USER_A');

// Declare width only in group VIEW for USER_A
$sm->declareSetting("width", 250, 'VIEW', 'USER_A');


use Skyline\Setting\SettingManagerInterface;
/** @var SettingManagerInterface $sm */

// Removes width only from default scope
$sm->removeSetting('width');

// Removes width only from group VIEW
$sm->removeSetting("width", 'VIEW');

// Removes width only for USER_A
$sm->removeSetting("width", NULL, 'USER_A');

// Removes width only from group VIEW for USER_A
$sm->removeSetting("width", 'VIEW', 'USER_A');

// Removes all settings with name width
$sm->removeSettingAll("width");