Re: Use pear as installation library
| From: | Gaetano Giunta | Date: | Thu, 05 May 2011 22:22:06 +0000 |
| Subject: | Re: Use pear as installation library | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-31108@lists.php.net to get a copy of this message | ||
On May 4, 2011, at 3:58 PM, Brett Bieber wrote:
On Tue, May 3, 2011 at 6:14 AM, Chen Xiongjie<chen.xcmail<at> gmail.com> wrote: Hi, pear I'm looking for a php installation library so I can use it for install our product's extension/plugin. Do you think is it good to use pear as the installation library.
typically questions: - Does it support extendable tag - Is the API of pear open? - Any documentation for using pear API? (I just found this one but it's just a api documentation:http://pear.php.net/manual/en/core.ppm.php) - for long term, will it be a kind of formal/unformal php installer library? I would use Pyrus if your application and extensions are PHP 5.3+. https://github.com/pear2/PEAR2_Pyrus The API is very easy to use. Here's a simple autoloader example which installs a package from a PEAR channel:https://github.com/saltybeagle/AutoloadPackage/blob/master/AutoloadPackage.php
The API is documented pretty well: http://pear.php.net/manual/en/pyrus.extending.installation.php PEAR packages are the easiest way to distribute upgradeable libraries of code for your application. -- Brett BieberHello. I'm working on the same project as Chen (the op), and can shed more light about our specific needs. I also have some more specific questions: The requirements are: . being able to install a "php application", not a library. It needs to be installed in a user-chosen directory if possible (so that many copies of the same app are installable in parallel), with utter disregard of pear standard installation directories . a web-based setup wizard should be run as soon as copying of files is done . as an alternative to the above (or in a 2nd step), we could replace the current web-based setup wizard with a pear-installer wizard (example of checks it currently does: variables in php.ini, presence of imagemagick in the PATH, presence of php extensions, proper write perms on some directories) . being able to install plugins for the original application (in a subdir of the app home dir). Again, some php scripts might have to be run after copying them . install updated versions of the app& plugins. In both cases, preinstall& postinstall scripts might have to be run (sql code& php scripts, the latter can be used to wrap the former) . have online repos to install app& plugins Using pyrus is not currently an option, as the app has to be compatible with php 5.2. If we use pear as main packages repository system, we could also have to use our pear channels to host plugins for older versions of the application, that are currently deployed on php 5.1 What I have found so far in my exploration: . besides postinstall scripts, custom file roles& file tasks can also be defined . the online documentation for those 3 hooks is a bit lacking, as only the xml for defining them is described, not really how they work. I could not easily find any tutorial nor example of project using those hooks; any would be welcome (eg. which one of these 3 hooks to use for different cases?) . since we already have a custom packaging format, with semantics richer (afaict) than the standard pear package.xml allows, a 1st integration step could be to simply produce a valid pear package.xml file that allows the user to download our custom-package and have the pear installer run the existing custom-package-installation php code either as post-install script or custom role / custom task. This is not the best solution in the long run, but it would allow a very fast integration of pear into the existing system. Any drawback or suggestion in this regard? Last but not least: I am also looking to implement a pear server on top of our current app (primary goal being able to turn the current "forge" site for plugins into a pear channel server). Here again, online docs are good but far from complete, as a lot of things are described as "use pear command xxx" instead of describing the actual operations undertaken by the pear installer in such case. Code is currently in alpha state, available at: http://svn.projects.ez.no/ezpearserver/ Thanks Gaetano