2

I have the need to move the Yii2-admin module to extensions folder from vendor folder. So my module is now extensions/mdmsoft.

In my config directory I add the alias

'mdmsoft/yii2-admin' =>
    array(
        'name'    => 'mdmsoft/yii2-admin',
        'version' => '1.0.4.0',
        'alias'   =>
            array(
                '@mdm/admin' => $extensionDir . '/mdmsoft/yii2-admin',
            ),
    ),

Where $extensionDir points to the extensions folder. I have done similar thing to other modules like yii2 user module and it works perfectly.

However in this case it doesn't work. I get the error

"Class mdm\admin\components\AccessControl does not exist"

It works well when it is in the vendor folder. But I need to move it to extensions folder to make some changes.

robsch
  • 9,358
  • 9
  • 63
  • 104
Harlan Gray
  • 341
  • 6
  • 20

1 Answers1

2

Moving things out of vendor dir can brake the class autoloader, which is made to work with composer. If you need to make changes to any composer based extension it's best to make a fork of it and add your fork to composer.json.

You don't even have to publish your version on packagist.org, you can add your repo in the repositories section of composer.json.

Jan Waś
  • 81
  • 4