10.02.2013 Views

PHP Programming Language - OpenLibra

PHP Programming Language - OpenLibra

PHP Programming Language - OpenLibra

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PEAR 166<br />

PEAR<br />

The <strong>PHP</strong> Extension and Application Repository, or PEAR, is a repository of <strong>PHP</strong> software code. Stig S. Bakken<br />

founded the PEAR project in 1999 to promote the re-use of code that performs common functions. The project seeks<br />

to provide a structured library of code, maintain a system for distributing code and for managing code packages, and<br />

promote a standard coding style. Though community-driven, the PEAR project has a PEAR Group which serves as<br />

the governing body and takes care of administrative tasks. Each PEAR code package comprises an independent<br />

project under the PEAR umbrella. It has its own development team, versioning-control and documentation.<br />

PEAR packages<br />

A PEAR package is distributed as a gzipped tar file. Each archive consists of source code written in <strong>PHP</strong>, usually in<br />

an object-oriented style. Many PEAR packages can readily be used by developers as ordinary third party code via<br />

simple include statements in <strong>PHP</strong>. More elegantly, the PEAR package manager which comes with <strong>PHP</strong> by default<br />

may be used to install PEAR packages so that the extra functionality provided by the package appears as an<br />

integrated part of the <strong>PHP</strong> installation. Unlike the Comprehensive Perl Archive Network (CPAN) archives, which<br />

PEAR took as its model, PEAR packages do not have implicit dependencies so that a package's placement in the<br />

PEAR package tree does not relate to code dependencies. Rather, PEAR packages must explicitly declare all<br />

dependencies on other PEAR packages.<br />

The PEAR base classes contain code for simulating object-oriented destructors and consistent error-handling.<br />

Packages exist for many basic <strong>PHP</strong> functions including authentication, caching, database access, encryption,<br />

configuration, HTML, web services and XML.<br />

PEAR package manager<br />

The PEAR package manager provides an easy way to install, uninstall, or upgrade with new PEAR packages or<br />

PECL extensions. Before installing a package it can also be instructed to take care of package dependencies so all<br />

the extra needed packages are installed too.<br />

The PEAR package manager is run from the command line using the pear command. Usually it is therefore only the<br />

server administrator who can alter the installed base of PEAR and PECL extensions. On <strong>PHP</strong> installations running<br />

on Linux, the PEAR package manager is ready for usage by default, but on Windows the PEAR package manager is<br />

only available after running a batch file called go-pear.bat.<br />

PECL<br />

PECL (<strong>PHP</strong> Extension Community Library, pronounced 'pickle') is conceptually very similar to PEAR, and indeed<br />

PECL modules are installed with the PEAR Package Manager. PECL contains C extensions for compiling into <strong>PHP</strong>.<br />

As C programs , PECL extensions run more efficiently than PEAR packages. PECL includes modules for<br />

XML-parsing, access to additional databases, mail-parsing, embedding Perl or Python in <strong>PHP</strong> scripts and for<br />

compiling <strong>PHP</strong> scripts. PECL spun off from the PEAR Project in October 2003. Originally it was called the PEAR<br />

Extension Code Library, but it now operates independently of PEAR.<br />

PECL extensions are documented alongside standard extensions within the <strong>PHP</strong> Manual, so there is no special<br />

manual for PECL extensions. Also, several extensions began their development cycle in PECL and ended up in core<br />

(the distributed <strong>PHP</strong> source) and in many of these cases the PECL versions become unmaintained.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!