2017-07-28 45 views
0

我在Github上分叉了一个库,现在想将我的分叉载入到项目中,而不需要将分叉库加入packagist。我得到以下错误添加库后,需要到我的composer.json:通过Github分叉载入一个作曲程序包

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

{ 
    "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 
} 

我曾尝试加入https://github.com/cnizzardini/ssl-certificate与不git的。我也尝试设置dev的最小稳定性和prefer-stable到false。

没有什么工作:-(

+0

可能重复[如何与作曲家需要叉](https://stackoverflow.com/questions/13498519/how-to-require-a-fork-with-composer) – rickdenhaan

+0

关闭,但修复我需要的是略有不同。我需要引用我的叉子。 – systematical

回答

2

composer.json文件,您的叉子仍然调用包"spatie/ssl-certificate",所以这是你需要,要求包的名称

这应该工作:

{ 
    ... 
    "require": { 
     ... 
     "spatie/ssl-certificate": "dev-master" 
    }, 
    ... 
    "repositories": [ 
     { 
      "type": "vcs", 
      "url": "https://github.com/cnizzardini/ssl-certificate.git" 
     } 
    ], 
    ... 
} 

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

{ 
    "name": "cnizzardini/ssl-certificate", 
    "description": "A class to easily query the properties of an ssl certificate ", 
    ... 
} 
+0

现在拉入spatie/ssl证书。我想要我的fork:cnizzardini/ssl-certificate – systematical

+1

如果这不起作用,你可以尝试的是在你的fork的[composer.json文件]中更改包名(https://github.com/cnizzardini/ssl-证书/ blob/master/composer.json) – rickdenhaan

+0

工作,如果你更新你的答案我会接受它是正确的。 – systematical