galileo/galileo-setting-bundle

Symfony Framework bundle responsible for adding simple configuration possiblities persisted in external storage mechanims

1.0.3 2017-04-06 09:01 UTC

README

SensioLabsInsight Scrutinizer Code Quality Build Status Code Coverage Latest Stable Version Latest Unstable Version License

GalileoSettingBundle

With this repository we will try to fill the gap of simple configuration and settings functionality handled by external storage mechanism.

Comparision to CraueConfigBundle

This bundle will add you some additional possibilities to handle your settings, and also is esier to use without exception handling in our application.

FUnctionality GalileoSettingBundle CraueSettingBundle
Get values without exception
Settings unique for all sections
Settings unique within section
GUI panel to manage settings
Set settings default values
Events exposed for customize actions
Change setting value
Established create function

Craue documentation:

https://github.com/craue/CraueConfigBundle

Basic usage:

Simple get:

$service('galileo.setting.setting')->get('our_settinng');

Get with default value:

$service('galileo.setting.setting')->get('email_address', 'hello@galileoprime.com');

Get users within sections, you can use them for example for user specific settings:

$service('galileo.setting.setting')->section('userId:{userId}')->get('email_address', 'hello@galileoprime.com');

Dispatched events

Events you can listen to

Event name Event class Implemented
galileo.setting.not_existing_setting_queried NotExistingSettingQueriedEvent
galileo.setting.setting_queried SettingQueriedEvent
galileo.setting.setting_created SettingCreatedEvent
galileo.setting.setting_changed SettingChangedEvent
galileo.setting.setting_deleted SettingDeletedEvent

Getter events

There are two different events that are called after you try to get some setting value.

The first one will be dispatched after you ask for setting that is not registered in any storage system.

You can listen for it with kernel.listener with event value galileo.setting.not_existing_setting_queried

class GalileoSettingNoteExistingSettingQueried

And the second one will be dispatched after you ask for setting that already exist in our storage system

The name you can listen to is galileo.setting.setting_queried

Setter events