1 PEAR introduction PEAR: PHPExtensionandApplicationRepository, php extension and application library. Pear's mission: to provide reusable components and lead php innovation. Provides PHP code packages and applications. Pear or php code Standard, 1. PEAR introduction
PEAR: PHP Extension and Application Repository, php Extension and Application library. Pear's mission: to provide reusable components and lead php innovation. Provides PHP code packages and applications. Pear or php code standards make php code easy to read and improve reusability.
2. install PEAR
When installing php, pear is installed by default in the bin directory. You can use the version parameter to view the version number.
$ ./pear versionPEAR Version: 1.9.4PHP Version: 5.4.26Zend Engine Version: 2.4.0
Verify that the include pathpear extension of php is installed under include path of php.
$ ./pear config-get php_dir/home/gang/php/lib/php
3. pear parameters
Directly running pear will output its parameters.
$ ./pearCommands:build Build an Extension From C Sourcebundle Unpacks a Pecl Packagechannel-add Add a Channelchannel-alias Specify an alias to a channel namechannel-delete Remove a Channel From the List...
Common parameters: info view package information install installation package uninstall Package list View locally installed package remote-list View online package
View the config configuration of the upgrade package config-show
View common parameter usage through help
$ ./pear help install
4. install the php package
For example, we want to install the LOG package
$ ./pear install LOG
After running successfully, the Log. php and Log directories are generated under the php/lib directory, and the doc directory contains examples and instructions under the doc/Log directory.
Upgrade LOG package:
./pear upgrade LOG
5. use of the installation package
The Log package we installed above. In the php code of the application, enter require.
log("Log entry $i");}
6. common php packages
PHPDoc? Document extraction tools
PHPUnit? Unit test framework
DB? Database encapsulation
You can run the following command to view all of them:
$ ./pear remote-list