首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过Github fork加载composer包

通过Github fork加载composer包
EN

Stack Overflow用户
提问于 2017-07-28 23:25:15
回答 1查看 2.6K关注 0票数 7

我在Github上派生了一个库,现在希望将我的派生加载到项目中,而不是将派生库添加到packagist中。在将存储库和require添加到我的composer.json后,我得到了以下错误:

代码语言:javascript
复制
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package cnizzardini/ssl-certificate 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.

这是我的完整composer.json

代码语言:javascript
复制
{
    "name": "cakephp/app",
    "description": "CakePHP skeleton app",
    "homepage": "http://cakephp.org",
    "type": "project",
    "license": "MIT",
    "require": {
        "php": ">=5.5.9",
        "cakephp/cakephp": "~3.4",
        "mobiledetect/mobiledetectlib": "2.*",
        "cakephp/migrations": "~1.0",
        "cakephp/plugin-installer": "*",
        "guzzlehttp/guzzle": "^6.2",
        "donatj/phpuseragentparser": "^0.7.0",
        "cnizzardini/ssl-certificate": "dev-master"
    },
    "require-dev": {
        "psy/psysh": "@stable",
        "cakephp/debug_kit": "~3.2",
        "cakephp/bake": "~1.1",
        "phpunit/phpunit": "^5.5"
    },
    "suggest": {
        "phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
        "cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
    },
    "autoload": {
        "psr-4": {
            "App\\": "src",
            "Api\\": "./plugins/Api/src",
            "Channel\\": "./plugins/Channel/src",
            "System\\": "./plugins/System/src",
            "Admin\\": "./plugins/Admin/src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Test\\": "tests",
            "Cake\\Test\\": "./vendor/cakephp/cakephp/tests",
            "Api\\Test\\": "./plugins/Api/tests",
            "Channel\\Test\\": "./plugins/Channel/tests",
            "System\\Test\\": "./plugins/System/tests",
            "Admin\\Test\\": "./plugins/Admin/tests"
        }
    },
    "scripts": {
        "post-install-cmd": "App\\Console\\Installer::postInstall",
        "post-create-project-cmd": "App\\Console\\Installer::postInstall",
        "post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/cnizzardini/ssl-certificate.git"
        }
    ],
    "minimum-stability": "stable",
    "prefer-stable": true
}

我已经尝试过使用和不使用.git来添加https://github.com/cnizzardini/ssl-certificate。我还尝试将最小稳定性设置为dev,将首选稳定设置为false。

什么都不工作:-(

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-28 23:30:11

分支上的composer.json文件仍然称为包"spatie/ssl-certificate",因此这是您需要的包的名称。

这应该是可行的:

代码语言:javascript
复制
{
    ...
    "require": {
        ...
        "spatie/ssl-certificate": "dev-master"
    },
    ...
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/cnizzardini/ssl-certificate.git"
        }
    ],
    ...
}

如果没有,您可以在自己的分支上通过更改包的composer.json文件中的name属性来重命名包:

代码语言:javascript
复制
{
    "name": "cnizzardini/ssl-certificate",
    "description": "A class to easily query the properties of an ssl certificate ",
    ...
}
票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45377221

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档