尝试使用composer安装PEAR扩展

时间:2015-03-31 13:14:15

标签: composer-php pear

我正在转换一个旧项目(使用旧的依赖项)来使用composer来管理它的依赖项。该网站使用PEAR的Text_Password。我读到可以通过composer.json将以下作曲家添加(如下所示)安装依赖项:

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

..但我收到错误:

$ composer update
Loading composer repositories with package information
Initializing PEAR repository http://pear.php.net
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

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

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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

是否可以使用Composer安装PEAR库?我注意到packagist上有一些PEAR库,但我看不到Text_Password - https://packagist.org/packages/pear/

还有一个用于Text_Password的github回购,但我想可能直接从PEAR安装更好? - https://github.com/pear/Text_Password

无论如何,如何使用composer安装此软件包?

1 个答案:

答案 0 :(得分:4)

你走了:

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