我可以使用PEAR在Web应用程序中包含模块吗?

I am creating a web app in LAMP. It was a while since I last created anything in PHP and back then I wasn't familiar with things like package managing and version control. I'm going to use MySQL in my app so I found the abstraction layer module MDB2 in PEAR.

My previous experiences tell me that I should be able to fetch the module to a lib/ subdirectory in my development repo, so that it will be present with every clone of the repo. But PEAR installs to /usr/share/php.

Can I make PEAR fetch to my development repo?

Or am I taking the wrong approach? My base problem is how to include a PHP module in the app that I'm creating.

You can configure PEAR to install into any directory you want, with a custom configuration file:

$ pear config-create lib pear.cfg

Now you need to tell the pear installer to use the config file:

$ pear -c pear.cfg install mdb2

That's all.


Btw, I recommend to use PDO as database layer if you don't need deep abstraction.