Home arrow MySQL arrow Page 2 - An Introduction to PEAR

An Introduction to PEAR

There have been several add-ons developed for PHP in the last couple of years, but none have reached the popularity of PEAR. PEAR is a framework and distribution for reusable PHP components. In this article John introduces us to PEAR, and more specifically, its PEAR::DB package, which is a set of classes that allows us to create generic code to talk to a variety of databases with minimal code changes.

Author Info:
By: John Ferme
Rating: 4 stars4 stars4 stars4 stars4 stars / 12
March 03, 2002
  1. · An Introduction to PEAR
  2. · What is PEAR?
  3. · The PEAR::DB class
  4. · Conclusion

print this article

An Introduction to PEAR - What is PEAR?
(Page 2 of 4 )

If you're familiar with Perl's CPAN library, then you'll find that PEAR is very similar in both concept and implementation. PEAR is an ongoing project that was started by Stig Bakken. Stig started PEAR to both encourage and define standards to help developers write reusable, portable, and efficient code. Although PEAR is still a work in progress, it is part of the GPL, and is therefore free to download and use.

The PEAR project is based on abstraction, which is essentially the process of remove all of the "junk" and only providing the bare minimum essentials to accomplish something. For example, PEAR's PEAR::DB package allows you to connect to a database by only specifying your database server, username and password. All of the connection settings and methods are performed internally to that class and are hidden from you.

Here's how Tomas Cox and Marin Jansen from pear.php.net describe PEAR:

PEAR is a repository for high quality PHP code and for PHP extensions written in C, that are distributed via an easy to use interface system.

Code in PEAR is compliant to the following points:
  • Has been approved to be part of PEAR by the PEAR developers and has the general consensus of the PEAR community.
  • Follows a unique coding standard (already standardized and used all over PEAR).
  • Uses a common error handling mechanism.
  • Tries to have a similar way of use.
  • Has documentation about its API in the PHPDoc format.
  • Has documentation/examples/test (to be marked as stable).
It's extremely easy to instantiate the classes that come bundled as PEAR packages, and the functionality of each package is excellent.
blog comments powered by Disqus

- MySQL and BLOBs
- Two Lessons in ASP and MySQL
- Lord Of The Strings Part 2
- Lord Of The Strings Part 1
- Importing Data into MySQL with Navicat
- Building a Sustainable Web Site
- Creating An Online Photo Album with PHP and ...
- Creating An Online Photo Album with PHP and ...
- PhpED 3.2 More Features Than You Can Poke ...
- Creating An Online Photo Album with PHP and ...
- Creating An Online Photo Album with PHP and ...
- Security and Sessions in PHP
- Setup Your Personal Reminder System Using PHP
- Create a IP-Country Database Using PERL and ...
- Developing a Dynamic Document Search in PHP ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials