anklimsk/cakephp-config-plugin
Composer 安装命令:
composer require anklimsk/cakephp-config-plugin
包简介
Initialize and get the plugin configuration for the CakePHP 2.x
README 文档
README
Initialize and get the plugin configuration.
This plugin provides next features:
- Initialize and get the plugin configuration.
Installation
-
Install the Plugin using composer:
composer require anklimsk/cakephp-config-plugin -
Add the next line to the end of the file
app/Config/bootstrap.php:CakePlugin::load('CakeConfigPlugin', ['bootstrap' => true]);
Using this plugin
-
Include in the
AppModelmodel of your plugin the behaviorInitConfig:public $actsAs = [ 'CakeConfigPlugin.InitConfig' => [ 'pluginName' => 'SomePluginName', 'checkPath' => 'SomePluginName.param' ] ];
-
Create a configuration file in the
Configdirectory of your plug-in, e.g.:somepluginname.php -
Fill configuration file, e.g.:
$config['SomePluginName'] = [ 'param' => 'value' ... ];
-
If necessary, copy config file from 'app/Plugin/SomePluginName/Config/somepluginname.php' to 'app/Config', and edit it.
-
If you need to overwrite the configuration parameter in the application, use:
Configure::write('SomePluginName.param', 'newValue'); // After, in Model call: $this->initConfig(true);
-
For initialize plugin configuration, use:
App::uses('InitConfig', 'CakeConfigPlugin.Utility'); $pluginName = 'SomePluginName'; $checkPath = 'SomePluginName.param'; $configFile = 'somepluginname'; $initConfig = new InitConfig($pluginName, $checkPath, $configFile); $force = false; $initConfig->initConfig($force);
统计信息
- 总下载量: 1.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-05