Bundle is used for storing configuration with Symfony2 in database using Doctrine2 ORM.
Thanks to Tobias Nyholm and Artem Zhuravlov for contribution.
- Easy-to-use (Twig extension, container service)
- Fast and extensible
- Settings scopes per user, global or all
- Settings validation using full power of Symfony2 Form Component
- 2 serialization mechanisms in DB: PHP's native
serialize()
and JSON + you can write your own - Settings caching
Symfony controller:
// Global settings
$this->get('settings_manager')->set('name', 'foo');
$this->get('settings_manager')->get('name'); // returns 'foo'
// User settings
$this->get('settings_manager')->get('name', $user); // returns global 'foo'
$this->get('settings_manager')->set('name', 'bar', $user);
$this->get('settings_manager')->get('name', $user); // returns 'bar'
Twig template:
{# Global setting #}
{{ get_setting('some_setting') }} {# => 'value' #}
{# User setting #}
{{ get_setting('some_user_setting', app.user) }} {# => 'value' #}
See the general usage documentation for more examples.
Please, do not hesitate to report bugs or send pull requests. It will help to motivate me to support library better than anything else :)
- Added optional caching
- New interface for your entity. We are no longer using
UserInterface
. UseSettingsOwnerInterface
instead. - Changed behavior of
SettingsManager::all
. It will not return global config if the user/local values are missing - Added possibility to add default value as third parameter on
SettingsManager::get
- Minor code improvements and bug fixes
- System messages translations to en, it, es, fr, de, ru, uk, sv languages
- Ability to choose serialization mechanism (php or json)
- Ability to add constraints to validation
- First stable version
Make sure to read the UPGRADE.md to successfully migrate your application.
The MIT License. For the full text of license, please, see LICENSE
© 2013-2015 Dmitriy Scherbina