作为依赖项

时间:2018-02-26 13:56:42

标签: composer-php

背景

在我的Laravel项目中,我使用名为PHP-FFMpeg的Composer依赖项,它具有依赖项BinaryDriver。我需要所有依赖项来支持Laravel 5.6所依赖的Symfony 4。由于BinaryDriver的原始版本不支持这个,我必须创建一个PHP-FFMpeg的分支,它使用支持Symfony 4的BinaryDriver分支。

我做了什么

我分叉了一个BinaryDrive的分支,它支持Symfony 4并创建了它的新版本(1.7.0)。然后我分叉了PHP-FFMpeg并创建了一个使用我的BinaryDriver分支的新版本(0.12.0)。

这就是PHP-FFMpeg fork的composer.json文件(https://github.com/gildebrand/PHP-FFMpeg)的样子:

{
    ...
    "require": {
        "php": "^5.3.9 || ^7.0",
        "alchemy/binary-driver": "^1.7.0",
        "doctrine/cache": "^1.0",
        "evenement/evenement": "^2.0 || ^1.0",
        "neutron/temporary-filesystem": "^2.1.1"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/gildebrand/BinaryDriver"
        }
    ]
    ...
}

我在我的主项目中使用PHP-FFMpeg fork(composer.json)

{
    ...
    "require": {
        "php": ">=7.1.3",
        "php-ffmpeg/php-ffmpeg": "^0.12.0",
        ...
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/gildebrand/PHP-FFMpeg"
        }
    ]
    ...
}

问题

在我的Laravel项目中运行composer update时,出现以下错误:

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

  Problem 1
    - Installation request for php-ffmpeg/php-ffmpeg ^0.12.0 -> satisfiable by php-ffmpeg/php-ffmpeg[0.12.0].
    - php-ffmpeg/php-ffmpeg 0.12.0 requires alchemy/binary-driver ^1.7.0 -> no matching package found.

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.

为了解决问题,我下载了我的PHP-FFMpeg fork并在那里运行composer install。令我惊讶的是,这一切都很好。所以似乎有一些限制阻止我的fork在我的项目中使用。可能导致此问题的原因是什么?我已尝试删除供应商文件夹以及删除composer.lock文件(使用composer update时不应该这样做,但仍然如此)。

0 个答案:

没有答案