来自自己的分叉存储库的Composer依赖

时间:2018-06-07 03:42:58

标签: yii2 composer-php

我有gitlab存储库https://gitlab.com/ajkosh/yii2-admin,下面是我的composer.json

{
    "name": "haruatari/yii2-module-app",
    "description": "Empty module application on Yii2",
    "minimum-stability": "stable",
    "license": "MIT",
    "authors": [
        {
            "name": "Viktor Pikaev",
            "email": "haruatari@gmail.com",
            "homepage": "http://haru-atari.com/about"
        }
    ],
    "repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:ajkosh/yii2-admin.git"
        }

    ],
    "require": {
         "php": ">=5.4.0",
        "yiisoft/yii2": "2.0.15",
        "yiisoft/yii2-bootstrap": "~2.0.0",
        "yiisoft/yii2-swiftmailer": "~2.0.0",
        "paulzi/yii2-materialized-path": "^2.0",
        "kartik-v/yii2-widget-select2":"2.0.4",
        "ajkosh/yii2-admin": "dev"
    },
    "require-dev": {
      "codeception/codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "config": {
    "fxp-asset": {
      "installer-paths": {
        "npm-asset-library": "vendor/npm",
        "bower-asset-library": "vendor/bower"
      }
    },
    "process-timeout": 1800},
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::postCreateProject"
        ]
    },
    "extra": {
        "yii\\composer\\Installer::postCreateProject": {
            "setPermission": [
                {
                    "runtime": "0777",
                    "web/assets": "0777",
                    "data": "0777",
                    "data/log": "0777",
                    "data/tmp": "0777",
                    "yii": "0755"
                }
            ],
            "generateCookieValidationKey": [
                "config/web.php"
            ]
        }
    }
}

我正在尝试从我自己的存储库中获取yii2-admin,但是当我运行composer update时,我遇到了错误。

 Problem 1
    - The requested package ajkosh/yii2-admin could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

1 个答案:

答案 0 :(得分:1)

您使用的包名称不正确。在解析依赖关系时,URL中的包名称无关紧要,唯一重要的名称是composer.json中的包名称。因此,Composer会从您的forked repository中读取composer.json,并找到名称mdmsoft/yii2-admin,因为您在分叉后没有更改它。根本没有ajkosh/yii2-admin。您应该在fork中的composer.json更新包名称:

{
    "name": "ajkosh/yii2-admin",
    "description": "RBAC Auth manager for Yii2 ",
    "keywords": ["yii", "admin", "auth", "rbac"],
    "type": "yii2-extension",
    ...

require部分中使用源包名称:

"require": {
    ...
    "mdmsoft/yii2-admin": "dev-master"
},