jorisvaesen / cakephp-settings
Read and write settings for CakePHP apps
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- cakephp/cakephp: ^3.6
- cakephp/migrations: ^1.8.0
Requires (Dev)
This package is not auto-updated.
Last update: 2025-01-19 07:16:59 UTC
README
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require jorisvaesen/cakephp-settings
Enable plugin:
bin/cake plugin load -b JorisVaesen/Settings
Migrate settings table
bin/cake migrations migrate -p JorisVaesen/Settings
Usage
Create setting
bin/cake joris_vaesen/settings.create
Read setting
use JorisVaesen\Settings\Settings; echo Settings::read($name);
Write setting
// 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');