Web interface to edit yii2 config files.
Note: Be carefull while editing config file, if you put wrong content, you will damage website and wont access it. Make sure you have file backup!
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist autoxloo/yii2-config-editor "*"
or add
"autoxloo/yii2-config-editor": "*"
to the require section of your composer.json
file.
In your config add:
'modules' => [
'editor' => [
'class' => \autoxloo\yii2\config\editor\ConfigEditorModule::class,
// You can set PhpContentRunner (default), JsonContentRunner
// or any other class which implements ContentRunnerInterface
'contentRunnerClass' => \autoxloo\yii2\config\editor\services\PhpContentRunner::class, // default
'configFilesList' => [
// list of files to allow edit
],
],
],
Once the module is installed and configured, you can use it.
If your module name is editor
, than available routes are:
/editor/editor/index
- List of config files to edit (ConfigEditorModule::configFilesList
)./editor/editor/edit/{id}
- Edit page of config file.
ContentRunner is class which implements autoxloo\yii2\config\editor\interfaces\ContentRunnerInterface
.
It allows to work with config file in different manner (json editor, php file editor...).
Available ContentRunners:
autoxloo\yii2\config\editor\services\PhpContentRunner
(default) Allows to edit php files as they are with php highlight. Uses\conquer\codemirror\CodemirrorWidget
. You can extend this class to changePhpContentRunner::getWidgetConfig()
to set own config for widget.autoxloo\yii2\config\editor\services\JsonContentRunner
Allows to edit files via json editor (widget\kdn\yii2\JsonEditor
). Note: it not saves comments.