'What are differences between PECL and PEAR?
I can see that GD library is for images. But I can't see differences between PECL and PEAR. Both have authentication. What are the main differences between two? Why don't they combine them?
Solution 1:[1]
PECL is a repository of C extensions for PHP. Those extensions are usually installed via the pecl command, which is an alias for pear, with the default channel/repository set to pecl.php.net.
PEAR is multiple things:
- The package installer (
pearcommand) that is able to install packages from different channels (repositories), including pecl.php.net. Many consider composer the successor of the pear installer. - The package repository http://pear.php.net/packages.php with ~600 libraries. Many of them are composer-installable.
- A PHP coding standard that is available with PHP_CodeSniffer.
Solution 2:[2]
pear is a php classes written in php Whereas pecl is extensions which not written in php and need compiling .
Solution 3:[3]
PEAR as-such is not a coding standard. Instead PEAR "follows" a set coding standard that is encouraged within the PHP Community. This is however not the only coding standard that PHP users can follow, the ZF, for eg. recommends a slightly different standard.
Solution 4:[4]
PEAR is also a coding standard ;-) php_codesniffer (install via $pear install php_codesniffer ) is a tool that will scan your code and hilight where it deviates from that or any other supported coding standard.
Solution 5:[5]
From my understanding, PHP has modules and frameworks, both being its libraries, external modules, called extensions, live in its PECL repository, while frameworks, called packages, live in its PEAR repository.
One can use PEAR packages within PHP code by simply sourcing the source code files, but PECL extensions should be installed on the system and enabled in configuration files to link to the interpreter.
Also, PEAR packages are written in PHP and are plain-text scripts, while PECL extensions are written in C/C++ and are compiled binaries in their consummable form.
Extensions as the name suggest extend PHP with something it doesn't offer by itself yet, while packages are just a collection of PHP code, ie. everything you can do with PHP proper.
This is parallel to Perl's PM modules and XS extensions.
That said, my view may not be 100% accurate, but that's how I could settle this in my mind :-)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | |
| Solution 3 | Just another guy |
| Solution 4 | kguest |
| Solution 5 | Elvin |
