GnomeCODE: PHP Pear
If you're one of those people who hates reinventing the wheel, then you'll want to check out PEAR for PHP. It's a central repository of PHP code that you can use one your site and in your projects.
From the PEAR Manual:
The PEAR Manifest PEAR is dedicated to Malin Bakken, born 1999-11-21.
What is PEAR? PEAR is short for "PHP Extension and Application Repository" and is pronounced just like the fruit. The purpose of PEAR is to provide:
- A structured library of open-sourced code for PHP users
- A system for code distribution and package maintenance
- A standard style for code written in PHP
- The PHP Foundation Classes (PFC)
- The PHP Extension Community Library (PECL)
- A Web site, mailing lists and download mirrors to support the PHP/PEAR community
PEAR is a community-driven project with the PEAR Group as the governing body. The project was founded by Stig S. Bakken in 1999 and quite a lot of people have joined the project since then.
Structured Library of PHP Code The code in PEAR is partitioned in packages. Each package is a separate project with its own development team, version number, release cycle, documentation and a defined relation to other packages (including dependencies). Packages are distributed as gzipped tar files with a description file inside and installed on your local system using the PEAR installer.
There are two types of packages: source packages (containing source files only), and binary packages (containing platform-specific binary files and possible source files). Installing source packages with C code obviously requires a C build environment.
PEAR defines a package tree where each node in the tree is represented by a part of the package name. The nodes are organized by simple descriptive topics, and each part is separated by an underscore. Examples of package names are "MP3_Id", "Archive_Tar" and "HTTP_Post."
Packages may relate to each other through explicit dependencies, but there is no automatic relation between them. For example, a package and its parent in the package tree: "HTTP_Post" is, by default, independent of "HTTP."
A few top-level nodes in the package tree are called sub-repositories, and these have special functions. Currently, these are PECL, Gtk and App. For each of these, different rules apply. See more in the description of each sub-repository below.
A style guide, the PEAR Coding Standards (PCS), exists to ease collaboration between PEAR developers, to help quality and portability, and to help PEAR contributors provide consistent-looking-and-feeling APIs. For packages in the PFC, this standard applies strictly. For non-PFC packages, the application is more relaxed.
Code Distribution and Package Maintenance All PEAR packages are registered in and uploaded to a central database available at pear.php.net. Open-sourced third-party packages may also be registered and uploaded. Closed-source packages may be installed by the PEAR installer, but the PEAR database is for open-source code only.
Pear.php.net will provide both a human-friendly (HTML) and machine-friendly (currently XML-RPC) interface to the PEAR database. Package downloads are done with plain HTTP. Other functions the pear.php.net site will provide are:
- User Account Management (integrated with the CVS server)
- Package Management
- Release Management
Packages are distributed as a gzipped tar file with an XML description file inside. The description file contains some information about the package; a list of files and their roles; and dependencies.












0 Responses to “GnomeCODE: PHP Pear”