I prefer managing my non-PEAR PHP dependencies (such as Zend Framework and PHPUnit) through PEAR channels when possible. It’s much easier to manage component installation, upgrades, etc.. Managing and hosting a PEAR channel (using the Chiara_PEAR_Server) is not always that simple, and can add too much overhead for small projects. I like how Zend Framework leveraged google code to host its PEAR channel, and was able to update it simply through pushing to SVN, avoiding a web interface. Since I’ve been accumulating some components recently that really don’t fit into pear.php.net, I figured it was time set up a PEAR channel for distributing them, but didn’t want to host it myself or have to use a web interface. Turns out, it’s really easy to do now.
Hosting using GitHub Pages
Since I prefer GitHub to Google Code for hosting my open source repositories, I decided to take a look at their new Pages feature for project web hosting. It’s super easy to set up. You can host content at http://username.github.com by creating a repository username.github.com (master branch), and can also host project related content at http://username.github.com/project by creating a top level gh-pages branch in the project. I was up and running in minutes. See here for specific instructions on setting it up.
PEAR Channel Serving with Pirum
I wasn’t sure what the ZF guys were using to manage their channel, so I started by looking at PEAR2‘s SimpleChannelServer. While it looks promising, and you can even manage it directly from pyrus, I ran into enough errors that I thought I’d take a look Pirum, another simple channel server written by the Symfony project maintainer. It worked for me right out of the box. Setup was as simple as:
pear channel-discover pear.pirum-project.org
pear install pirum/Pirum
cd ~/git/pirum
# create pirum.xml file
pirum build .
# commit changes and push to github
So now releases through my PEAR channel look like this:
# update PEAR package.xml, then run:
pear package
cd ~/git/pirum
pirum add . ~/git/deneb/Deneb-0.3.0.tgz
# commit changes and push to github
Now I’ve got an easily managed PEAR Channel that I don’t have to host: http://shupp.github.com/pirum
Leave a Reply