Composer没有在PHP项目中安装依赖项

时间:2017-06-24 07:41:17

标签: php paypal composer-php

我试图将Paypal PHP SDK添加到我的项目中:

composer require "paypal/rest-api-sdk-php:*"

但我一直收到以下错误,并且作曲家没有将 \ vendor 添加到我的项目中。

user@user:/opt/lampp/htdocs/projects/paypal/ipn$ composer require "paypal/rest-api-sdk-php:*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-curl * is missing from your system. Install or enable PHP's curl extension.
  Problem 2
    - phpunit/phpunit 3.7.9 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.6 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.38 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.37 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.36 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.35 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.34 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.33 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.32 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.31 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.30 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.29 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.28 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.27 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.26 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.25 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.24 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.23 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.22 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.21 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.20 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.19 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.18 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.17 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.16 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.15 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.14 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.13 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.12 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.11 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.10 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - Installation request for phpunit/phpunit 3.7.* -> satisfiable by phpunit/phpunit[3.7.0, 3.7.1, 3.7.10, 3.7.11, 3.7.12, 3.7.13, 3.7.14, 3.7.15, 3.7.16, 3.7.17, 3.7.18, 3.7.19, 3.7.2, 3.7.20, 3.7.21, 3.7.22, 3.7.23, 3.7.24, 3.7.25, 3.7.26, 3.7.27, 3.7.28, 3.7.29, 3.7.3, 3.7.30, 3.7.31, 3.7.32, 3.7.33, 3.7.34, 3.7.35, 3.7.36, 3.7.37, 3.7.38, 3.7.4, 3.7.5, 3.7.6, 3.7.7, 3.7.8, 3.7.9].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-mysqli.ini
    - /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.
user@user:/opt/lampp/htdocs/projects/paypal/ipn$ 

我也试过:composer install会抛出以下错误:

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

  Problem 1
    - The requested PHP extension ext-curl * is missing from your system. Install or enable PHP's curl extension.
  Problem 2
    - phpunit/phpunit 3.7.9 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.6 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.38 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.37 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.36 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.35 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.34 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.33 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.32 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.31 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.30 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.29 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.28 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.27 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.26 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.25 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.24 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.23 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.22 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.21 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.20 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.19 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.18 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.17 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.16 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.15 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.14 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.13 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.12 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.11 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.10 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 3.7.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - Installation request for phpunit/phpunit 3.7.* -> satisfiable by phpunit/phpunit[3.7.0, 3.7.1, 3.7.10, 3.7.11, 3.7.12, 3.7.13, 3.7.14, 3.7.15, 3.7.16, 3.7.17, 3.7.18, 3.7.19, 3.7.2, 3.7.20, 3.7.21, 3.7.22, 3.7.23, 3.7.24, 3.7.25, 3.7.26, 3.7.27, 3.7.28, 3.7.29, 3.7.3, 3.7.30, 3.7.31, 3.7.32, 3.7.33, 3.7.34, 3.7.35, 3.7.36, 3.7.37, 3.7.38, 3.7.4, 3.7.5, 3.7.6, 3.7.7, 3.7.8, 3.7.9].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.0/cli/php.ini
    - /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.0/cli/conf.d/10-opcache.ini
    - /etc/php/7.0/cli/conf.d/10-pdo.ini
    - /etc/php/7.0/cli/conf.d/20-calendar.ini
    - /etc/php/7.0/cli/conf.d/20-ctype.ini
    - /etc/php/7.0/cli/conf.d/20-exif.ini
    - /etc/php/7.0/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.0/cli/conf.d/20-ftp.ini
    - /etc/php/7.0/cli/conf.d/20-gettext.ini
    - /etc/php/7.0/cli/conf.d/20-iconv.ini
    - /etc/php/7.0/cli/conf.d/20-json.ini
    - /etc/php/7.0/cli/conf.d/20-mysqli.ini
    - /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.0/cli/conf.d/20-phar.ini
    - /etc/php/7.0/cli/conf.d/20-posix.ini
    - /etc/php/7.0/cli/conf.d/20-readline.ini
    - /etc/php/7.0/cli/conf.d/20-shmop.ini
    - /etc/php/7.0/cli/conf.d/20-sockets.ini
    - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.0/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.0/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.0/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
user@user:/opt/lampp/htdocs/projects/paypal/ipn$ 

我可能做错了什么?

提前谢谢大家。

这是我的应用程序的composer.json:

{
    "require" : {
        "paypal/rest-api-sdk-php" : "*"
    }
}

1 个答案:

答案 0 :(得分:3)

无法满足paypal/rest-api-sdk-php composer中指示的平台要求,这就是Problem 1 - The requested PHP extension ext-curl * is missing from your system. Install or enable PHP's curl extension. 拒绝安装软件包的原因:

--ignore-platform-reqs

要求包裹$ composer require paypal/rest-api-sdk-php --ignore-platform-reqs

如果你只关心需要包,你可以运行

php

供参考,请参阅composer.json

  

- ignore-platform-reqs :忽略hhvmlib-*ext-*--ignore-platform-reqs要求并强行安装,即使本地机器不满足这些。另请参阅https://getcomposer.org/doc/03-cli.md#require配置选项。

使用composer.json

安装软件包

假设包

  • 已添加到composer.lock
  • composer.json$ composer install --ignore-platform-reqs
  • 中的更改保持同步

你可以运行

php

供参考,请参阅platform

  

- ignore-platform-reqs :忽略hhvmlib-*ext-*composer.lock要求并强行安装,即使本地机器不满足这些。另请参阅https://getcomposer.org/doc/03-cli.md#install配置选项。

要了解composer.json是否与$ composer validate 中的更改保持同步,请运行

ext/curl

注意:您可能仍然无法使用软件包,因为软件包依赖于要安装的ext/curl。要确保您可以在计算机上安装和使用该程序包,您应该在该计算机上安装func loadDataFromURL() { // Fetch URL let url = URL(string: "https://www.apple.com/nl/today/static/data/hub/1101000001001110001.json")! // Load Data let data = try! Data(contentsOf: url) // Deserialize JSON let json = try! JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: AnyObject] let coursesJSON = json?["courses"] as? [AnyObject] for object in coursesJSON! { let id = object["id"] as! String if coursesDict[id] == nil { let name = object["shortName"] as! String let program = object["programName"] as! String let shortDescription = object["shortDesc"] as! String let mediumDescription = object["mediumDesc"] as! String let longDescription = object["longDesc"] as! String let imageURL = object["image"] as! String let tempCourse = Course(id: id, name: name, program: program, shortDescription: shortDescription, mediumDescription: mediumDescription, longDescription: longDescription, imageURL: imageURL) coursesDict[id] = tempCourse table.reloadData() } } print(coursesDict.count, "loadURL") } }