phpcodeigniterframeworkspearpyrus

Including Pear Libraries in PHP Frameworks


How should PEAR libraries be incorporated as packages / libraries within PHP frameworks?

Namely, I'm using a package system within a PHP framework - and need those PEAR libraries to be easily redistributable (I'm referring specifically to CodeIgniter's package manager, Sparks) to other users. Would it be better to couple the needed PEAR libraries and their dependencies within the package itself, or to instead do a check when the package is initialized (ie constructor, init, factory, whatever called) and prompt (along with download instructions) that that user install the necessary dependencies?

The latter option may not work for some users who lack either the necessary permissions (ie shared hosting?) or the necessary technical knowledge (don't laugh, I'm serious) to install PEAR libraries, ie framework users, not programmers / system admins.

Coupling opens the risk of code duplication within a project, even if it greatly simplifies making the package "just work". What route would YOU take?


Solution

  • Use Pyrus, the next-gen pear installer and follow the instructions in Using Pyrus To Manage PEAR Installable Vendor Libs.