PHP code example of execut / yii2-base

1. Go to this page and download the library: Download execut/yii2-base 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/ */

    

execut / yii2-base example snippets



namespace execut\users;


class Bootstrap extends \execut\yii\Bootstrap
{
    public function getDefaultDepends()
    {
        return [
            'bootstrap' => [
                'yii2-navigation' => [
                    'class' => \execut\navigation\Bootstrap::class,
                ],
                'yii2-crud' => [
                    'class' => \execut\crud\Bootstrap::class,
                ],
            ],
            'modules' => [
                'users' => [
                    'class' => Module::class,
                ],
            ],
        ];
    }
    
    public function bootstrap($app)
    {
        parent::bootstrap($app); // Здесь можно задать код для бутстрапа модуля. Родителя вызвать обязательно
    }
}

...
'bootstrap' => [
    'users' => [
        'class' => \execut\users\Bootsrap::class,
    ],
],
...

...
'bootstrap' => [
    'users' => [
        'class' => \execut\users\Bootsrap::class,
        'depends' => [
            'modules' => [
                'users' => [
                    'defaultRoute' => '/users'
                ],
            ],
        ],
    ],
],
...

class CustomWidget extends \execut\yii\jui\Widget
{
    public function run()
    {
        /**
         * If you want append assets files and create javascript widget instance
         */
        $this->registerWidget();
        
        /**
         * Or if you want only append assets files
         */
        $this->_registerBundle();

        /**
         * renderContainer - helper method for wrapping widget in div container with defined in widget options
         */
        $result = $this->renderContainer($this->renderWidget());

        return $result;
    }
    
    protected function renderWidget() {
        /**
         * Here generate widget out $result
         */
         
         return $result;
    }
}

class CustomWidgetAsset extends \execut\yii\web\AssetBundle
{
}