我已经在Bitbucket上创建了一个带有外部模块的私有存储库,并将其添加到项目的composer.json文件中的依赖项列表中。 问题是" composer install"我将我的模块下载到vendor文件夹中,但它抛出了一个ReflectionException:
类示例\ news \ Module不存在
外部模块composer.json:
{
"name": "example/yii2-module-news",
"description": "News",
"type": "yii2-extension",
"keywords": ["yii2", "extension", "news"],
"authors": [
{
"name": "me"
}
],
"autoload": {
"psr-4": {
"example\\news\\": ""
}
},
"require": {
"2amigos/yii2-ckeditor-widget" : "~1.0",
"kartik-v/yii2-widgets": "*",
"kartik-v/yii2-grid": "@dev",
"kartik-v/yii2-editable": "@dev",
"kartik-v/yii2-krajee-base": "@dev",
"kartik-v/yii2-helpers": "*",
"kartik-v/yii2-mpdf" : "*"
}
}
project composer.json
"repositories": [
{
"type": "package",
"package": {
"name": "example/yii2-module-news",
"version": "master",
"source": {
"type": "git",
"url": "git@bitbucket.org:example/yii2-module-news.git",
"reference": "master"
}
}
}
]
vendor / composer / autoload_psr4.php确实包含有关新外部模块的任何记录
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'yii\\twig\\' => array($vendorDir . '/yiisoft/yii2-twig'),
'yii\\swiftmailer\\' => array($vendorDir . '/yiisoft/yii2-swiftmailer'),
'yii\\jui\\' => array($vendorDir . '/yiisoft/yii2-jui'),
'yii\\gii\\' => array($vendorDir . '/yiisoft/yii2-gii'),
'yii\\faker\\' => array($vendorDir . '/yiisoft/yii2-faker'),
'yii\\debug\\' => array($vendorDir . '/yiisoft/yii2-debug'),
'yii\\composer\\' => array($vendorDir . '/yiisoft/yii2-composer'),
'yii\\codeception\\' => array($vendorDir . '/yiisoft/yii2-codeception'),
'yii\\bootstrap\\' => array($vendorDir . '/yiisoft/yii2-bootstrap'),
'yii\\' => array($vendorDir . '/yiisoft/yii2'),
'voskobovich\\behaviors\\' => array($vendorDir . '/voskobovich/yii2-many-many-behavior/src'),
'skeeks\\widget\\chosen\\' => array($vendorDir . '/skeeks/yii2-widget-chosen'),
'rmrevin\\yii\\fontawesome\\' => array($vendorDir . '/rmrevin/yii2-fontawesome'),
'mihaildev\\elfinder\\' => array($vendorDir . '/mihaildev/yii2-elfinder'),
'kartik\\tree\\' => array($vendorDir . '/kartik-v/yii2-tree-manager'),
'kartik\\select2\\' => array($vendorDir . '/kartik-v/yii2-widget-select2'),
'kartik\\growl\\' => array($vendorDir . '/kartik-v/yii2-widget-growl'),
'kartik\\form\\' => array($vendorDir . '/kartik-v/yii2-widget-activeform'),
'kartik\\dialog\\' => array($vendorDir . '/kartik-v/yii2-dialog'),
'kartik\\datetime\\' => array($vendorDir . '/kartik-v/yii2-widget-datetimepicker'),
'kartik\\daterange\\' => array($vendorDir . '/kartik-v/yii2-date-range'),
'kartik\\date\\' => array($vendorDir . '/kartik-v/yii2-widget-datepicker'),
'kartik\\base\\' => array($vendorDir . '/kartik-v/yii2-krajee-base'),
'dosamigos\\ckeditor\\' => array($vendorDir . '/2amigos/yii2-ckeditor-widget/src'),
'dmstr\\' => array($vendorDir . '/dmstr/yii2-adminlte-asset'),
'creocoder\\nestedsets\\' => array($vendorDir . '/creocoder/yii2-nested-sets/src'),
'cebe\\markdown\\' => array($vendorDir . '/cebe/markdown'),
'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'),
);
答案 0 :(得分:0)
作曲家存储库配置看起来太复杂了。应该更容易工作,例如:
"repositories": [
{
"type": "git",
"url": "git@bitbucket.org:example/yii2-module-news.git"
},
]