通过Github分支加载作曲家程序包

cni*_*ini 5 composer-php

我在Github上派生了一个库,现在想将我的fork加载到项目中,而无需将派生的库添加到packagist中。添加存储库后出现以下错误,并要求将其添加到composer.json:

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.
Run Code Online (Sandbox Code Playgroud)

这是我完整的composer.json

{
    "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
}
Run Code Online (Sandbox Code Playgroud)

我尝试添加带有和不带有.git的https://github.com/cnizzardini/ssl-certificate。我还尝试将dev的最小稳定性设置为false,将宁愿稳定的设置为false。

什么都没用:-(

ric*_*aan 6

composer.json你的 fork 上的文件仍然调用 package "spatie/ssl-certificate",所以这是你需要的包的名称。

这应该有效:

{
    ...
    "require": {
        ...
        "spatie/ssl-certificate": "dev-master"
    },
    ...
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/cnizzardini/ssl-certificate.git"
        }
    ],
    ...
}
Run Code Online (Sandbox Code Playgroud)

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

{
    "name": "cnizzardini/ssl-certificate",
    "description": "A class to easily query the properties of an ssl certificate ",
    ...
}
Run Code Online (Sandbox Code Playgroud)

  • 如果这不起作用,您可以尝试更改 fork 的 [composer.json 文件](https://github.com/cnizzardini/ssl-certificate/blob/master/composer.json) 中的包名称 (2认同)