使用git repository中的composer安装包

时间:2016-04-04 14:13:29

标签: git laravel laravel-5 composer-php laravel-5.1

我正在尝试从私有存储库安装一个包,但是出现错误:

Problem 1
- The requested package chef-php-api 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.

我已经检查了名称问题,似乎没有一个错字问题,我的名字,我有一套&#34;最小稳定性&#34;:&#34; dev& #34;在我的composer.json中,所以不确定我做错了什么。

这是我的composer.json文件:

{
  "name": "laravel/laravel",
  "description": "The Laravel Framework.",
  "keywords": ["framework", "laravel"],
  "license": "MIT",
  "type": "project",
  "repositories": [
    {
        "type": "git",
        "name": "chef-php-api",
        "url": "https://urlOfTheRepository/chef-php-api.git"
    }
  ],
  "require": {
    "php": ">=5.5.9",
    "laravel/framework": "5.1.*",
    "chef-php-api": "*"
  },
  "require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~4.0",
    "phpspec/phpspec": "~2.1"
  },
  "autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    }
  },
  "autoload-dev": {
    "classmap": [
        "tests/TestCase.php"
    ]
  },
  "scripts": {
    "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "post-root-package-install": [
        "php -r \"copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ]
  },
  "config": {
    "preferred-install": "dist"
  },
  "minimum-stability": "dev",
  "prefer-stable": true
}

1 个答案:

答案 0 :(得分:4)

您的require部分有"chef-php-api": "*"。这对于包不正确。您的要求应采用"vendor/package": "*"的形式,因此请务必根据您的要求添加供应商部分。

如果您不确定要添加的内容,请查看name包的composer.json文件中的chef-php-api值。这是您应该添加到require部分的内容。