Composer不会安装软件包依赖项

时间:2017-05-30 14:49:20

标签: laravel composer-php packagist

我创建了composer包,其中composer.json是

{
    "name": "xxxx/yyyyy",
    "description": "xyz",
    "license": "MIT",
    "authors": [
        {
            "name": "xxx",
            "email": "xx@ttt.com"
        }
    ],
    "version": "1.0.0",
    "type": "package",
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*",
        "tymon/jwt-auth": "0.5.*",
        "dimsav/laravel-translatable": "^6.0",
        "doctrine/dbal": "^2.5",
        "felixkiss/uniquewith-validator": "2.*",
        "owen-it/laravel-auditing": "^3.1",
        "venturecraft/revisionable": "1.*",
        "yadakhov/insert-on-duplicate-key": "^1.1"
    },
    "autoload": {
        "psr-4": {
            "XXX\\YYY\\" : "/src"
        }
    }
}

现在,当我安装我的

xxxx/yyyy

包,我需要作曲家安装所有必需的包:

"require": {
    "php": ">=5.6.4",
    "laravel/framework": "5.3.*",
    "tymon/jwt-auth": "0.5.*",
    "dimsav/laravel-translatable": "^6.0",
    "doctrine/dbal": "^2.5",
    "felixkiss/uniquewith-validator": "2.*",
    "owen-it/laravel-auditing": "^3.1",
    "venturecraft/revisionable": "1.*",
    "yadakhov/insert-on-duplicate-key": "^1.1"
},

但它没有安装它。

我尝试使用composer update,composer install。有人可以帮忙吗?

Project Composer.json看起来像

{    
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.4.*",
        "laravel/tinker": "~1.0",       
        "xxxx/yyyy" : "1.0.0"    
    },    
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "xxxx/yyyy",
                "version": "1.0.0",
                "source": {
                    "url": "example.com",
                    "type": "git",
                    "reference": "master"
                },
                "autoload": {
                    "psr-4" : {
                       "XXX\\YYY\\" : "/src"
                    }
                }
            }
       }
    ] 
}

我能做什么,Composer会自动安装所有包所需的依赖项????谢谢你的建议。

1 个答案:

答案 0 :(得分:1)

不要使用package存储库类型。使用此功能时,必须复制通常位于所引用软件的composer.json文件中的所有信息。

package存储库适用于无法将composer.json文件添加到软件源的情况。您可以完全控制您的包裹,因此不适用。

只需添加类型为vcs的存储库链接以及存储库的URL,Composer将通过查看存储库中的composer.json文件来确定其余部分。它将检测依赖关系并安装它们。