t4web / site-config
Admin module for ZF2. Provide key-value configuration
Installs: 1 150
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.5.0
- t4web/default-service: ~1.0.0
- t4web/domain: ~1.1.2
- zendframework/zend-console: <2.6 >=2.4
- zendframework/zend-db: <2.6 >=2.4
- zendframework/zend-modulemanager: <2.6 >=2.4
- zendframework/zend-mvc: <2.6 >=2.4
Requires (Dev)
- phpunit/phpunit: ~4.5
README
ZF2 Module. Site config module - provide key-value configuration.
Installation
Main Setup
By cloning project
Clone this project into your ./vendor/
directory.
With composer
- Now tell composer to download SiteConfig by running the command:
$ composer require t4web/site-config:"~2.0.0"
- Create tables by initial script:
$ php public/index.php site-config init
Post installation
- Enabling it in your
application.config.php
file.
<?php return array( 'modules' => array( // ... 'T4web\SiteConfig', ), // ... );
Quick start
Insert scopes and values to tables site_config_values
and site_config_scopes
:
INSERT INTO `site_config_scopes` (`id`, `name`) VALUES (1, 'products'); INSERT INTO `site_config_values` (`id`, `scope_id`, `name`, `value`) VALUES (1, 1, 'items-per-page', 20);
Use it anywhere
$siteConfig = $serviceLocator->get("T4web\SiteConfig\Config"); $siteConfig->get('items-per-page', 'products'); //... $siteConfig->set('items-per-page', 'products', 10);