1. Go to this page and download the library: Download yii2mod/yii2-cms 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/ */
namespace app\widgets;
use yii\base\Widget;
class MyWidget extends Widget
{
/**
* @inheritdoc
*/
public function run()
{
parent::run();
echo 'Text from widget';
}
/**
* This function used for render the widget
*
* @return string
*/
public static function show()
{
return self::widget();
}
}
public function actions()
{
return [
'page' => [
'class' => 'yii2mod\cms\actions\PageAction',
'baseTemplateParams' => [
'homeUrl' => 'your site home url',
'siteName' => Yii::$app->name
]
],
];
}