将pear / xml_parser添加到composer.json

时间:2015-02-02 19:43:43

标签: php composer-php pear

我试图在我的 Laravel 项目中包含pear / xml_serializer。所以,在composer.json文件中我做了

"repositories": {
    "phppear": {
        "type": "pear",
        "url": "http://pear.php.net"
    }
},

要加载回购,然后我将它包含在require部分中,如下所示:

"require": {
    ...
    "pear/xml_serializer": "dev-master"
},

这很好用。问题是这个包需要pear / xml_parser,但是需要

"require": {
    ...
    "pear/xml_parser": "dev-master",
    "pear/xml_serializer": "dev-master"
},

不起作用。 xml_parser2也没有。我收到这个错误:

The requested package pear/xml_parser2 could not be found in any version, there may be a typo in the package name.

我必须假设这意味着它无法找到包,但我无法弄清楚如何加载它。我已尝试过上述命令的几种不同变体。包裹在这里:

http://pear.php.net/package/xml_serializer http://pear.php.net/package/xml_parser2

但只能找到第一个?我是否需要从其他地方获取xml_parser?

感谢您的帮助。

1 个答案:

答案 0 :(得分:3)

请试一试:

{
    "require": {
        "pear-pear.php.net/xml_parser": "*",
        "pear-pear.php.net/xml_serializer": "*"
    },
    "repositories": [
        {
            "type": "pear",
            "url": "http://pear.php.net"
        }
    ]
}

结果:

 ...
  - Installing pear-pear.php.net/xml_parser (1.3.4)
  - Installing pear-pear.php.net/xml_serializer (0.20.2)