PEAR 和 Composer 有什么区别? [英] What is the difference between PEAR and Composer?

查看:37
本文介绍了PEAR 和 Composer 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PEAR 用于安装 PHP 软件包和 Composer 用于同样的事情.我相信 Composer 可以更好地处理依赖关系,但这是唯一的区别吗?谁能解释这两个包管理器之间的区别并告诉我何时使用哪个?

PEAR is used to install a PHP software package and Composer is used for the same thing. I believe Composer handles dependencies better but is that the only difference? Can anybody explain the difference between these two package managers and tell me when to use which?

推荐答案

将 PEAR 视为已弃用可能有点早,但我不相信它需要很长时间.Composer 正在蓬勃发展和成熟,有很多包和积极的开发.因此,最好将 Composer 用作 PHP 中的 包标准 管理工具.

It might be a bit soon to regard PEAR as deprecated but I don't believe it will take long before it is. Composer is thriving and mature with a lot of packages and and active development. Therefore it might be better to use Composer as the standard for package management tool in PHP.

对于包维护者来说,使用 PEAR 比较麻烦.因此 PEAR 上的很多代码都已经过时了.开发人员需要在 PEAR 上发布之前对其包进行PEAR-reviewed",因此与 Composer 中可用的包数量相比,可用的包很少/a>.此外,没有办法在 PEAR 中为单个项目安装包.所有软件包都全局安装.使用 Composer,您可以为每个项目安装一个包全局.好吧,PEAR 中缺乏依赖管理,坦率地说,这应该是包管理器做得好的一件事.

Using PEAR is more cumbersome for package maintainers. Therefore a lot of the code on PEAR is outdated. A developer needs to get it packages 'PEAR-reviewed' before it might get published on PEAR, so few packages are available compared to the number of packages available in Composer. Also, there is no way to install a package in PEAR for one single project. All packages are installed globally. With Composer you can install packages one a per-project basis or globally. Well and then there is the lack of dependency management in PEAR, which frankly should be the one thing a package manager does well.

可以使用 PEAR 而不是使用 Composer 的一件事是安装 PECL 扩展.然而,pickle 使用 Composer 并允许您在 composer.json 文件中定义原生 PHP 扩展依赖项.pickle 项目目前正在经历相当多的发展,还不应该被认为是成熟的.

One thing you can do with PEAR and not with Composer is installing PECL extensions. There is however pickle which uses Composer and lets you define native PHP extentions dependencies in your composer.json file. The pickle project is momentarily undergoing quite some development and should not yet be considered mature.

Fabien Potencier 的这篇博文可能有点自以为是,但我认为这是非常正确的.如果您有选择,请选择 Composer,这样 PEAR 就可以安详地死去.即使您询问 PEAR 维护人员,大多数人都会告诉您您认为 Composer 是前进的方向,尽管有些人可能仍然对 Pyrus 抱有希望.(这是为了对 PEAR 进行改进,但在 Composer 的爆炸式流行中被埋没了.)

This blog post by Fabien Potencier might be a bit opinionated, but I think it is quite right. If you have an option, choose Composer so PEAR can die in peace. Even when you ask the PEAR maintainers most will tell you that Composer is the way forward, although some might still have their hopes for Pyrus. (This was intended to be PEAR improved, but got kindof buried under the exploding popularity of Composer.)

顺便说一句,您也可以使用 Composer 安装 PEAR 包,请参阅 Composer 文档.

By the way, you can use Composer to install PEAR packages as well, see the Composer documentation.

另请参阅:
[1] 关于 PHP 包管理的信息幻灯片

这篇关于PEAR 和 Composer 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆