0.1.0releasedSettings
Symphony CMS Extension for storing and retrieving key/value settings in a simple and clean way.
Clone URLhttps://github.com/pointybeard/settings.git
Add as a submodulegit submodule add https://github.com/pointybeard/settings.git extensions/settings --recursive
Compatibility
2.x.x | 2.1.x | 2.2.x | 2.3.x | 2.4.x | 2.5.x | 2.6.x | 2.7.0 | 2.7.1 | 2.7.2 | 2.7.3 | 2.7.4 | 2.7.5 | 2.7.6 | 2.7.7 | 2.7.8 | 2.7.9 | 2.7.10 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 | 0.1.0 |
Readme
Settings Extension for Symphony CMS
- Version: 0.1.0
- Date: March 11 2020
- Release notes
- GitHub repository
A Symphony CMS Extension for storing and retrieving key/value settings in a simple and clean way.
Installation
This is an extension for Symphony CMS. Add it to your /extensions
folder in your Symphony CMS installation, run composer update
to install required packages and then enable it though the interface.
Requirements
This extension requires PHP 7.3 or greater.
This extension depends on the following Composer libraries:
Run composer update
on the extension/settings
directory to install these.
Usage
Here is an example of how to use this extension in your code.
Saving Settings
There are 2 ways to save settings. By browsing to "System" > "Settings" in the admin and adding/editing/deleting settings or in code by using the Settings model.
```php <?php
declare(strict_types=1);
use pointybeardSymphonyExtensionsSettingsModels;
// Saving a new setting (new ModelsSettings) ->name("mysetting") ->value("one two three") ->group("myapp") ->save() ; ```
Retriving Settings
The main use of this extension is going to be to recall settings when needed. There are 2 important methods to know about:
ModelsSetting::fetchByGroup()
and ModelsSetting::loadFromNameFilterByGroup()
```php <?php
declare(strict_types=1);
use pointybeardSymphonyExtensionsSettingsModels;
// Retrieve a single setting using both it's name and group $setting = ModelsSetting::loadFromNameFilterByGroup("mysetting", "myapp");
// Retrieve an entire group of settings $setting = ModelsSetting::fetchByGroup("myapp"); ```
The fetchByGroup()
method returns an instance of SettingsSettingsResultIterator
which includes an additional method you can use to find specific settings in a group of results.
```php <?php
declare(strict_types=1);
use pointybeardSymphonyExtensionsSettingsModels;
// Find a specific setting from a group of settings and return its value $value = ModelsSetting::fetchByGroup("myapp")->find("mysetting"); ```
Support
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.
Contributing
We encourage you to contribute to this project. Please check out the Contributing documentation for guidelines about how to get involved.
License
"Settings Extension for Symphony CMS" is released under the MIT License.
Version history
Works up to Symphony 2.7.10