laravel软件包开发-开发相互依赖的多个软件包

时间:2018-11-12 06:11:21

标签: laravel composer-php

我正在尝试为以前相互依赖的软件包建立开发环境。我可以设置laravel和一个packages目录,在其中将所有软件包都克隆到其中。但是现在,当我将它们添加到laravel composer.json文件并运行composer update时,出现以下错误。

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for tjventurini/sunshine dev-master -> satisfiable by tjventurini/sunshine[dev-master].
    - tjventurini/sunshine dev-master requires tjventurini/articles ^0.1.8 -> satisfiable by tjventurini/articles[v0.1.8] but these conflict with your requirements or minimum-stability.
  Problem 2
    - tjventurini/articles dev-master requires tjventurini/tags ^0.0.9 -> satisfiable by tjventurini/tags[v0.0.9] but these conflict with your requirements or minimum-stability.
    - tjventurini/articles dev-master requires tjventurini/tags ^0.0.9 -> satisfiable by tjventurini/tags[v0.0.9] but these conflict with your requirements or minimum-stability.
    - Installation request for tjventurini/articles dev-master -> satisfiable by tjventurini/articles[dev-master].

这是我的laravel composer.json文件的样子:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "type": "project",
    "minimum-stability": "dev",
    "prefer-stable" : true,
    "repositories": [
        {
            "type": "path",
            "url": "packages/sunshine"
        },
        {
            "type": "path",
            "url": "packages/articles"
        },
        {
            "type": "path",
            "url": "packages/portfolio"
        },
        {
            "type": "path",
            "url": "packages/tags"
        },
        {
            "type": "path",
            "url": "packages/mini-bootstrap-theme"
        },
        {
            "type": "path",
            "url": "packages/contact"
        }
    ],
    "require": {
        "php": ">=7.0.0",
        "fideloper/proxy": "~3.3",
        "laravel/framework": "5.5.*",
        "laravel/tinker": "~1.0",
        "tjventurini/mini-bootstrap-theme": "dev-master",
        "tjventurini/tags": "dev-master",
        "tjventurini/articles": "dev-master",
        "tjventurini/portfolio": "dev-master",
        "tjventurini/contact": "dev-master",
        "tjventurini/sunshine": "dev-master"
    },
    "require-dev": {
        "filp/whoops": "~2.0",
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "~1.0",
        "phpunit/phpunit": "~6.0",
        "symfony/thanks": "^1.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}

在添加其他软件包之前,composer确实在供应商目录中为标签和mini-bootstrap-theme软件包创建了符号链接。

我还已经添加了最小稳定性设置。

谢谢!

1 个答案:

答案 0 :(得分:0)

由于@ Norman-N的评论,我可以很快找到答案。正如他指出的那样,我必须使用别名才能将dev-master用作特定的版本/标记。

这里是composer documentation

的链接

我如下所示更改了composer.json

"tjventurini/articles": "dev-master as 0.1.8",
"tjventurini/contact": "dev-master as 0.0.9",
"tjventurini/mini-bootstrap-theme": "dev-master as 0.0.3",
"tjventurini/portfolio": "dev-master as 0.0.17",
"tjventurini/sunshine": "dev-master as 0.2.10",
"tjventurini/tags": "dev-master as 0.0.9"