About Me
   Rene's Resume
   Rates & Contracts
   Portfolio / Clients
   Demo Apps
   White Papers & Tips
   Contact Me

Tutorials > PEAR > Using PEAR in your PHP Code

Once you've downloaded and installed PEAR using the code in your programs is very simple.

PEAR packages are predominantly classes that you can reference in your code. These classes reside in php files that you must include in your programs. Including these files is just like including any other file. The only thing you need to know before including the file is the name of the file. Luckily the file name is derived from the PEAR package name. In our case we're working with the XML_RSS package. The correspoding file name is ’XML/RSS.php’ To create the file name just change the underscore to a slash and add ’.php’ to the end. You can now include the file as follows:

require_once 'XML/RSS.php';

PHP looks in it's include_path for an ’XML’ directory and a file named ’RSS.php’ within that directory. This file contains the code used to parse an RSS feed.

That's all there really is to using PEAR. Once you've included the file you can now access all the code in those files. It's important to read about the classes and functions within the file. Specific package information is available on the PEAR website.


This page was generated in 0.0030 seconds.
Website content © 2017