PHP code example of jorisvaesen / cakephp-settings

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

    

jorisvaesen / cakephp-settings example snippets


use JorisVaesen\Settings\Settings;

echo Settings::read($name);

// Using simple find and update
$settingsTable = TableRegistry::getTableLocator()->get('JorisVaesen/Settings.Settings');
$setting = $settingsTable->find('name', ['name' => 'SETTING_NAME'])->first();
$setting->set('value', 'NEW VALUE');
$settingsTable->save($setting);

// Write method
TableRegistry::getTableLocator()->get('JorisVaesen/Settings.Settings')
    ->write('NAME', 'NEW_VALUE');