Section 2.2. Using PEAR As Often As Possible

Divide and Conquer > Using PEAR As Often As Possible

2.2. Using PEAR As Often As Possible

We've talked about PEAR a bit already, but what exactly is it? PEAR can be best described through its core features, which are as follows:


Code library

PEAR offers a very complete code library. All code is packaged and structured in a hierarchy of categories. Each library has its own developers and maintenance team, all easily reachable through email.

Categories include but are not limited to: authentication, caching, database, HTML, HTTP, images, internationalization, networking, payment, web services and XML.


Code distribution and package maintenance

Code is distributed in the form of packages through the a command-line utility called the PEAR installer.[ ] The installer lets you manage all package interdependencies while installing, upgrading, or removing packages from your system.

[ ] The PEAR installer is itself available as a package (http://pear.php.net/package/PEAR).

If you want, you also have access to a code repository where you can get last-minute updates to packages. Though not recommended, this access is sometimes preferable if you need a specific feature that wasn't shipped with the library package.


Code writing standard style

Because many people contribute code to the PEAR repository, it was necessary to control the way code is written. These efforts culminated into what is now called the PEAR Coding Style.[||] To achieve greater readability and consistency with the best practices, you should also follow these rules within your own code:

[||] PEAR Coding Style, or PCS, is a set of code-writing guidelines followed by all of the code available on the PEAR repository (http://pear.php.net/manual/en/standards.php).


PECL

PHP Extension Community Library (PECL) is the separate repository for low-level PHP extensions. The main difference between PECL and PEAR is the nature of their packages. PECL packages are low-level, C language code that is installed as a direct PHP extension. PEAR packages are high-level, PHP language code that is made available as a class or set of classes.


Community-powered support

Support is available in the following ways: package documentation on the web site, mailing lists, tutorials all around the Web, presentation slides, and community forums. There are also numerous books on the market about, or related to, PEAR.

You are welcome to participate in the various community support forums. By doing so, you are generating more information and helping other developers.

As you can see, PEAR fits perfectly into the large-scale web development paradigm. It provides access to a repository of reusable code distributed through a packaging system and supported by a community-driven set of tools.

NOTE

Simply follow these instructions to have PEAR up and running in no time:

  1. Go to http://go-pear.org/

  • Save the document content as go-pear.php.

  • Run php go-pear.php on your command -line.

  • For more information, please visit http://pear.php.net/manual/en/installation.php.

    Another interesting characteristic of PEAR is the possibility of deploying your own PEAR server, or channel. Having your own channel means that you'll have to package your own code following all of the PEAR standards.

    It also means that you'll have an easy way to maintain and deploy your own code on your servers. You'll be able to create code dependencies, and install, remove, or update packages without the hassle usually associated with these tasks.

    There are many sources of documentation about installing your own PEAR channel, but we recommend Tobias Schlitt's excellent tutorial, available at his blog, http://tinyurl.com/2doqj4.

     

     



    PHP and Smarty on Large-Scale Web Development
    PHP and Smarty on Large-Scale Web Development
    ISBN: 047008023X
    EAN: N/A
    Year: 2007
    Pages: 20
    BUY ON AMAZON

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net