尝试通过composer安装facebook / php-sdk-v4时出现InvalidArgumentException

时间:2016-03-01 02:31:16

标签: symfony composer-php facebook-sdk-4.x

我尝试通过composer安装最新的Facebook SDK但是我收到了这个错误:

$ composer require facebook/php-sdk-v4


  [InvalidArgumentException]                                                                                                                           
  Could not find package facebook/php-sdk-v4 at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability  

阅读upgrade guide之后,我认为也许我的php版本不兼容,所以我检查了版本:

$ php -v
PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with XCache v3.1.0, Copyright (c) 2005-2013, by mOo
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with XCache Optimizer v3.1.0, Copyright (c) 2005-2013, by mOo
    with XCache Cacher v3.1.0, Copyright (c) 2005-2013, by mOo
    with XCache Coverager v3.1.0, Copyright (c) 2005-2013, by mOo

如何解决此问题并安装Facebook SDK? 感谢

1 个答案:

答案 0 :(得分:1)

需要更多的挖掘,但我终于找到了这个安装的问题。我正在使用Symfony 2.8,似乎默认的Symfony项目使用默认的php版本预配置composer,即使你可能安装了更高版本。版本字符串位于config

composer.json部分
"config":{
  "bin-dir":"bin",
  "platform":{
    "php":"5.3.9"
  }
}

一旦我将值更改为5.4.0,我就可以安装Facebook SDK。

有关这些问题的更多讨论包括herehere