Posted on 19 April 2005 by Demian Turner
Hello,
I’m posting this to clear up how to find the PEAR path on most servers, and then at the end are instructions how to use PEAR in your PHP programs.
Editors note: this article is for beginner to intermediate level users, and I think will be useful to many as reported problems installing PEAR are still widespread in the forums, etc. – Demian
Posted on 09 March 2005 by Demian Turner
There are many good reasons for following the PEAR coding standards which I don’t have time to go into now, a slightly elabourated version of the ‘rules’ is available here, mostly borrowed from the Horde project.
But by far the most convincing reason to use the file naming convention, which means that a class located in your include path like Foo/Bar/Baz.php is called Foo_Bar_Baz, is the ability to take advantage of PHP 5’s __autoload magic method.
What this means is that if you instantiate the above class, and forgot to require it, it can be located and loaded automatically, from any of hundreds of classes in your include path. Here’s the code:
function __autoload($class)
{
$filename = str_replace('_', '/', $class) . '.php';
@require_once $filename;
}
Posted on 10 February 2005 by Demian Turner
If you need to run directory listings through various filters and transforms,
File_Util::listDir is your friend, especially with the recently added callback
final arg.
Check out recent Seagull code updates to see the flexibility of the current approach,
we need to consolidate all Seagull directory methods in order for next step of
front controller to be implemented.
getAllNavDrivers() is the first converted method, it makes use of callbacks,
lambda fns and pass-by-ref to update filtered dir listings.
Posted on 09 February 2005 by Demian Turner
Our man Greg
Beaver has been working overtime getting the latest
version of the PEAR
package manager ready. He also has a blog which is a great
way to keep uptodate with all the latest PEAR package mgr
news. Some recent entries include:
If you really want to know everything that’s gone on with the package manager, you can read through the posts at http://news.php.net/php.pear.core.
And if you’ve read all this and you’re wonder "why is this guy always
going on about PEAR package mgr" (as indicated by the poll in the
bottom left corner
then just keep in mind some of the following:
- one of the keys to the success of the Linux platform is tools like RPM, apt-get and more recently yum
- one of the pillars of Redhat’s success is the RHN or Redhat Network
- package management has a long history with other languages and a well-trodden track record with, eg, CPAN.
Posted on 23 January 2005 by Demian Turner
Thanks to Rares for this new Flexy plugins tutorial, check it out here and take advantage of this powerful aspect of the Flexy templating system.
Posted on 20 January 2005 by Demian Turner
General
| PEAR manual |
http://pear.php.net/manual/en/ |
| PEAR overview |
http://conf.php.net/pres/index.php?p=slides%2Fpear&id=pear |
| Getting started with PEAR |
http://www.sitepoint.com/article/getting-started-with-pear |
| Introduction to PEAR |
http://php-mag.net/itr/online_artikel/psecom,id,388,nodeid,114.html |
| PEAR based Deployment |
http://php-mag.net/itr/online_artikel/psecom,id,385,nodeid,114.html |
| Inside PHP and PEAR Development |
http://php-mag.net/itr/online_artikel/psecom,id,324,nodeid,114.html |
| PEAR and PECL Packaging |
http://www.zend.com/pear/tutorials/howtopackage.php |
| Web installer |
http://talks.php.net/show/sdphp_using_tools/1 |
| Web installer (*) |
http://www.phpkitchen.com |
|
* works with PHP 4.2.3 |
Package Tutorials
Posted on 27 April 2003 by Demian Turner
Thanks go out to Wolfram Kriesing for having put together the following tutorial for the excellent PEAR::Tree package.
For those of you who don’t know, PEAR::Tree is a package that provides methods to read and manipulate trees, which are stored in the DB or an XML file. The trees can be stored in the DB either as nested trees. Or as simple trees, which use parentId-like structure. Currently XML data can only be read from a file and accessed. The package offers a large number of methods to access and manipulate trees. For example methods like: getRoot, getChild[ren], getParent, getPath and many more.
To get up and running you will need to download the package from the PEAR site. Here are the API docs to get you started.
UPDATE: there are a number of sites linking to this page, I’m afraid a link to the cited tutorial is no longer available as the original author removed it.