简体   繁体   English

正确安装作曲家的依赖

[英]Correctly install a depenency from composer

I have installed the last version of laravel (7).我已经安装了最后一个版本的 laravel (7)。 Now I need a certain package:( mercadopago/dx-php )现在我需要某个 package:(mercadopago/dx-php)

And throws the following conflict:并引发以下冲突:

Problem 1
    - Installation request for mercadopago/dx-php ^2.0 -> satisfiable by mercadopago/dx-php[2.0.0].
    - Conclusion: remove doctrine/inflector 2.0.3
    - Conclusion: don't install doctrine/inflector 2.0.3

- mercadopago/dx-php 2.0.0 requires doctrine/inflector ^1.0 -> satisfiable by doctrine/inflector[1.0.x-dev, 1.1.x-dev, 1.2.x-dev, 1.3.1, 1.3.x-dev, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.x-dev, v1.0, v1.0.1, v1.1.0, v1.2.0, v1.3.0].

 - Can only install one of: doctrine/inflector[1.4.0, 2.0.3].
    - Can only install one of: doctrine/inflector[1.4.1, 2.0.3].
    - Can only install one of: doctrine/inflector[1.4.2, 2.0.3].
    - Can only install one of: doctrine/inflector[1.4.3, 2.0.3].
    - Can only install one of: doctrine/inflector[1.4.x-dev, 2.0.3].
    - Can only install one of: doctrine/inflector[1.0.x-dev, 2.0.3].
    - Can only install one of: doctrine/inflector[1.1.x-dev, 2.0.3].
    - Can only install one of: doctrine/inflector[1.2.x-dev, 2.0.3].
    - Can only install one of: doctrine/inflector[1.3.1, 2.0.3].
    - Can only install one of: doctrine/inflector[1.3.x-dev, 2.0.3].
    - Can only install one of: doctrine/inflector[v1.0, 2.0.3].
    - Can only install one of: doctrine/inflector[v1.0.1, 2.0.3].
    - Can only install one of: doctrine/inflector[v1.1.0, 2.0.3].
    - Can only install one of: doctrine/inflector[v1.2.0, 2.0.3].
    - Can only install one of: doctrine/inflector[v1.3.0, 2.0.3].
    - Installation request for doctrine/inflector (locked at 2.0.3) -> satisfiable by doctrine/inflector[2.0.3].

I tried:我试过了:

composer depends doctrine/inflector

And throws: laravel/framework v7.15.0 requires doctrine/inflector (^1.4|^2.0)并抛出: laravel/framework v7.15.0 requires doctrine/inflector (^1.4|^2.0)

If I understood correctly, everything will work fine if I remove doctrine/inflector[2.0.3], and install, for example, doctrine/inflector[1.4.3].如果我理解正确,那么如果我删除了原则/变形器[2.0.3],并安装例如原则/变形器[1.4.3],一切都会正常工作。

composer.lock has the following: composer.lock 具有以下内容:

"name": "doctrine/inflector",
            "version": "2.0.3",
            "source": {... etc

What is the correct way of installing doctrine/inflector version 1.4.3, having already installed 2.0.3?已经安装了 2.0.3 的理论/变形器版本 1.4.3 的正确安装方法是什么?

Seems everything works fine just by doing似乎一切正常

composer require doctrine/inflector:1.4.0

It throws the following warning when doing composer diagnose though:但是在进行作曲家诊断时会引发以下警告:

require.doctrine/inflector: exact version constraints (1.4.3) should be avoided if the package follows semantic versioning. require.doctrine/inflector:如果 package 遵循语义版本控制,则应避免精确的版本约束 (1.4.3)。

Remove your file composer.lock , remove your folder vendor and run composer require "mercadopago/dx-php:2.2.1"删除您的文件composer.lock ,删除您的文件夹vendor并运行composer require "mercadopago/dx-php:2.2.1"

Installing the doctrine/inflector:1.4.0 brought me some problems, such as the reflection of name of tables in the database for models.安装doctrine/inflector:1.4.0给我带来了一些问题,比如模型在数据库中的表名的反映。

The most viable solution, it seems to me, is to install mecadopago/dx-php in another directory and include this new autoload in your application's payment service.在我看来,最可行的解决方案是将mecadopago/dx-php安装在另一个目录中,并将这个新的自动加载包含在应用程序的支付服务中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM