Install Yii2 extension manually without using Composer

后端 未结 3 1966
無奈伤痛
無奈伤痛 2020-12-04 17:05

I want to install Select 2 extension widget manually with Yii2 Framework without using composer.

I done the following steps but it\'s not working.

1)

相关标签:
3条回答
  • 2020-12-04 17:39

    It is subrepository .GIT , delete .git from vendor\kartik-v\yii2-widget-select2 and git rm --cached yii2-widget-select2

    Stash, Commit,Push.

    0 讨论(0)
  • 2020-12-04 17:41

    It's highly recommended to use composer instead.

    But if you want to do it manually:

    1) Download archive of needed version from Github.

    2) Open composer.json.

    3) Find PSR-4 autoload section and remember it, in your case: kartik/select2.

    4) Extract files to corresponding folder in vendor: vendor/kartik/select2 (not yiisoft!).

    5) Add to vendor/composer/autoload_psr4.php:

    'kartik\\select2\\' => array($vendorDir . '/kartik/select2'),
    

    6) Add to vendor/yiisoft/extensions.php:

    'kartik/select2' => array (
        'name' => 'kartik/select2',
        'version' => '2',
        'alias' => array (
            '@kartik/select2' => $vendorDir . '/kartik/select2',
        ),
    ),
    

    samdark, one of the core contributors has the article in russian about it on his official blog here. It's basically brief translated version.

    As you can see it's quite a lot of work to do. Multiply it by number of extensions and it becomes pain.

    Seriously, use composer. If the hoster doesn't support it, find another one.

    0 讨论(0)
  • 2020-12-04 17:43

    You can use yii2-workbench package. It designed for easy intergrate package without composer. It support composer autoload and bootstrap

    0 讨论(0)
提交回复
热议问题