2017 © Pedro PelΓ‘ez
 

yii2-extension yii2-base

My base classes for yii2

image

execut/yii2-base

My base classes for yii2

  • Monday, July 16, 2018
  • by eXeCUT
  • Repository
  • 1 Watchers
  • 0 Stars
  • 25,850 Installations
  • PHP
  • 12 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 25 Versions
  • 8 % Grown

The README.md

yii2-base

My base classes for yii2, (*1)

Bootstrap system

execut\yii\Bootstrap

Π­Ρ‚ΠΎΡ‚ класс Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌ для возмоТности иСрархичСского запуска ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ‚ΠΎΠ² для Ρ€Π°Π·Π»ΠΈΡ‡Π½Ρ‹Ρ… ΠΌΠΎΠ΄ΡƒΠ»Π΅ΠΉ. Допустим Π΅ΡΡ‚ΡŒ ΠΌΠΎΠ΄ΡƒΠ»ΡŒ users, для своСй Ρ€Π°Π±ΠΎΡ‚Ρ‹ ΠΎΠ½ Ρ‚Ρ€Π΅Π±ΡƒΠ΅Ρ‚ Π½Π°Π²ΠΈΠ³Π°Ρ†ΠΈΡŽ execut/yii2-navigation ΠΈ ΠΌΠΎΠ΄ΡƒΠ»ΡŒ CRUD execut/yii2-crud. Π˜Ρ… Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΠΎ Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ Π΄ΠΎ запуска основного модуля users. ΠŸΡ€ΠΈ этом самим этим ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ‚Π°ΠΌ Π½ΡƒΠΆΠ½ΠΎ Π·Π°ΠΏΡƒΡΠΊΠ°Ρ‚ΡŒ Π΅Ρ‰Ρ‘ ΠΊΠΎΠΌΠΎΠ½Π΅Π½Ρ‚Ρ‹ для своСй Ρ€Π°Π±ΠΎΡ‚Ρ‹. НапримСр, execut/yii2-crud Ρ‚Ρ€Π΅Π±ΡƒΠ΅Ρ‚ ΠΏΠ°ΠΊΠ΅Ρ‚ execut/yii2-actions. Π‘ ΠΏΠΎΠΌΠΎΡ‰ΡŒΡŽ execut\yii\Bootstrap ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ‚Ρ‹ рСкурсивно сами подцСпят сСбС всё Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΠΎΠ΅ ΠΈ Π½Π΅ Π½ΡƒΠΆΠ½ΠΎ ΠΎΠ± этом Π·Π°Π±ΠΎΡ‚ΠΈΡ‚ΡŒΡΡ. Нам-ΠΆΠ΅ Π½ΡƒΠΆΠ½ΠΎ Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ ΠΌΠΎΠ΄ΡƒΠ»ΡŒ users ΠΈ ΡƒΠΊΠ°Π·Π°Ρ‚ΡŒ ΠΎΡ‚ запуска ΠΊΠ°ΠΊΠΈΡ… ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ‚ΠΎΠ² ΠΎΠ½ зависит. Для этого Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΠΎ Ρ€Π΅Π°Π»ΠΈΠ·ΠΎΠ²Π°Ρ‚ΡŒ ΠΏΠΎΡ‚ΠΎΠΌΠΊΠ° класса \execut\yii\Bootstrap, объявив Π² Π½Ρ‘ΠΌ всС зависимости модуля users ΠΈ саму настройку модуля users:, (*2)

<?php
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); // Π—Π΄Π΅ΡΡŒ ΠΌΠΎΠΆΠ½ΠΎ Π·Π°Π΄Π°Ρ‚ΡŒ ΠΊΠΎΠ΄ для бутстрапа модуля. РодитСля Π²Ρ‹Π·Π²Π°Ρ‚ΡŒ ΠΎΠ±ΡΠ·Π°Ρ‚Π΅Π»ΡŒΠ½ΠΎ
    }
}

ПослС этого добавляСм Π² ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΡŽ прилоТСния запуск модуля users. ΠŸΡ€Π΅Π»Π΅ΡΡ‚ΡŒ Π±ΡƒΡ‚Ρ€Π°ΠΏΠ° Π² Ρ‚ΠΎΠΌ, Ρ‡Ρ‚ΠΎ сам ΠΌΠΎΠ΄ΡƒΠ»ΡŒ ΠΊΠ°ΠΊ ΠΈ всС Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΡ‹Π΅ ΠΊΠΎΠΌΠΏΠΎΠ½Π΅Π½Ρ‚Ρ‹ ΡƒΠΊΠ°Π·Ρ‹Π²Π°Ρ‚ΡŒ Π² ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ прилоТСния Π½Π΅ Π½ΡƒΠΆΠ½ΠΎ, ΠΏΠΎΡΠΊΠΎΠ»ΡŒΠΊΡƒ это всё ΠΈ Ρ‚Π°ΠΊ объявлСно Π² бутстрапС:, (*3)

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

Если Π΅Ρ‰Ρ‘ Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΠΎ Π·Π°Π΄Π°Ρ‚ΡŒ ΠΌΠΎΠ΄ΡƒΠ»ΡŽ ΠΏΠ°Ρ€Π°ΠΌΠ΅Ρ‚Ρ€Ρ‹ окруТСния прилоТСния, Ρ‚ΠΎ ΡƒΠΊΠ°Π·Ρ‹Π²Π°Π΅ΠΌ ΠΈΡ… Ρ‡Π΅Ρ€Π΅Π· Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΈΠ²Ρƒ depends Π² ΠΊΠΎΠ½Ρ„ΠΈΠ³Π΅:, (*4)

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

Widgets system

execut\yii\jui\Widget

This class provides the ability to simplify create jquery widgets with assets files if you want. To create a widget, you must create files in follow structure:, (*5)

  • CustomWidget.php
  • CustomWidgetAsset.php
  • assets\CustomWidget.js
  • assets\CustomWidget.css
  1. CustomWidget.php

Create class for you widget:, (*6)

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;
    }
}
  1. CustomWidgetAsset.php

Define asset bundle class in same folder and name with postfix Asset, (*7)

class CustomWidgetAsset extends \execut\yii\web\AssetBundle
{
}
  1. assets\CustomWidget.js

If you want javascript functional, create jquery widget file assets\CustomWidget.js:, (*8)

(function () {
    $.widget("customNamespace.CustomWidget", {
        _create: function () {
            var t = this;
            t._initElements();
            t._initEvents();
        },
        _initElements: function () {
            var t = this,
                el = t.element,
                opts = t.options;
        },
        _initEvents: function () {
            var t = this,
                el = t.element,
                opts = t.options;
        }
    });
}());
  1. assets\CustomWidget.css

If you want css styles, create file assets\CustomWidget.css:, (*9)

.custom-widget {
}

The Versions

16/07 2018

dev-master

9999999-dev https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

16/07 2018

1.8.0

1.8.0.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

19/04 2018

1.7.0

1.7.0.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

05/04 2018

1.6.4

1.6.4.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

04/01 2018

1.6.3

1.6.3.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

19/12 2017

1.6.2

1.6.2.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

04/10 2017

1.6.1

1.6.1.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

02/10 2017

1.6.0

1.6.0.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

06/09 2017

1.5.2

1.5.2.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

08/08 2017

1.5.0

1.5.0.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

08/08 2017

1.5.1

1.5.1.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

02/08 2017

1.4.0

1.4.0.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

01/05 2017

1.3.0

1.3.0.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

26/04 2017

1.2.3

1.2.3.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

02/04 2017

1.2.1

1.2.1.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

02/04 2017

1.2.2

1.2.2.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

14/11 2016

dev-mvc-test-support

dev-mvc-test-support https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

14/11 2016

1.1.0

1.1.0.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

14/11 2016

1.2.0

1.2.0.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

01/02 2016

1.1.5

1.1.5.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

26/01 2016

1.1.4

1.1.4.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

11/12 2015

1.0.3.x-dev

1.0.3.9999999-dev https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

11/12 2015

1.1.3

1.1.3.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

27/11 2015

1.0.2.x-dev

1.0.2.9999999-dev https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2

27/11 2015

1.1.2

1.1.2.0 https://github.com/execut/yii2-base

My base classes for yii2

  Sources   Download

Apache-2.0

The Requires

 

by Avatar eXeCUT

yii2