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

查看:189
本文介绍了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上发布,因此与Composer中可用的程序包数量相比,几乎没有可用的程序包.同样,也无法在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扩展依赖关系.泡菜项目目前正在经历相当大的发展,尚不成熟.

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.

此博客文章有点自以为是,但我认为这是完全正确的.如果可以选择,请选择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软件包管理的信息幻灯片

See also:
[1] Informative slide deck about PHP package management

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

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