ecom / setting
The setting component of ecom
dev-master
2014-01-03 16:28 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-12-19 19:36:39 UTC
README
The setting component of ecom.
Features
- Multiple storage backend support, such as RDMBS database and Redis.
- Custom storage backend support, by implement the StorageInterface interface.
- ArrayAccess support, you can access settings just like arrays.
Installation
The recommended way to install ecom-setting is via composer.
-
Add a single line to composer.json:
"require": { ... "ecom/setting": "dev-master" ... }
-
Run composer to update denpendencies:
$ cd /path/to/project $ php composer.phar update
Usage
-
Import the table schema located in data directory
-
Set up settings as application component
//... 'aliases' => array( 'ecom' => 'application.vendors.ecom', ), 'components' => array( //... 'setting' => array( 'class' => 'ecom\settings\Setting', ), //... ), //...
- Store settings via setting component.
$settings = Yii::app()->getComponent('setting'); $settings->set('foo', 'value of foo'); $bar = $settings->get('bar', 'default value'); $settings->delete('foo'); //you can also using settings like arrays $settings['foo'] = 'value of foo'; $bar = $settings['bar']; unset($settings['foo']);
Authors
- Jin Hu bixuehujin@gmail.com
Licence
- MIT