1. Go to this page and download the library: Download shurik2k5/yii2-settings library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
class Site extends Model {
public $siteName, $siteDescription;
public function rules()
{
return [
[['siteName', 'siteDescription'], 'string'],
];
}
public function fields()
{
return ['siteName', 'siteDescription'];
}
public function attributes()
{
return ['siteName', 'siteDescription'];
}
}
function actions(){
return [
//....
'site-settings' => [
'class' => 'pheme\settings\SettingsAction',
'modelClass' => 'app\models\Site',
//'scenario' => 'site', // Change if you want to re-use the model for multiple setting form.
//'section' => 'site', // By default use modelClass formname value
'viewName' => 'site-settings' // The form we need to render
],
//....
];
}
php composer.phar
php composer.phar install
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.