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.x2.1.x2.2.x2.3.x2.4.x2.5.x2.6.x2.7.02.7.12.7.22.7.32.7.42.7.52.7.62.7.72.7.82.7.92.7.10
0.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.00.1.0

Readme

Settings Extension for Symphony CMS

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