【问题标题】:laravel package development - develop multiple packages that depend on eachotherlaravel package development - 开发多个相互依赖的包
【发布时间】:2018-11-12 06:11:21
【问题描述】:

我正在尝试为我以前开发的相互依赖的软件包设置开发环境。我可以设置 laravel 和一个包目录,我将所有包克隆到其中。但是现在当我将它们添加到 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 确实设法在供应商目录中为标签和迷你引导主题包创建了符号链接。

另外,我已经添加了最低稳定性设置。

谢谢!

【问题讨论】:

  • 您需要设置正确的别名版本,即。 "tjventurini/articles": "dev-master as 0.1.9",

标签: laravel composer-php


【解决方案1】:

感谢@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"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-08
    • 1970-01-01
    • 2015-09-08
    • 1970-01-01
    • 1970-01-01
    • 2016-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多