PHP packages are distributed through Pear channels. If you want to download a PHP package, it’s as simple as downloading Pear and using it. The process of using pear is telling it the "channel" you want to download the package from, and then telling it to download the package. That's what you do if you want to download somebody else's PHP. If you want other people to be able to download yours, you have to make your own pear channel. We had to do that recently, and it turns out there’s an easy way to do it thanks to GitHub and Fabien Potencier's Pirum. It’s pretty straightforward. Here come the lists. So many lists! Like 40. Still. Straightforward. By the way, you'll need to install pear and install git if you haven't already.
Create a new repository on GitHub called pear
Make the project on github
$ mkdir pear
$ cd pear
$ git init
$ git remote add origin git@github.com:[your git username]/pear.git
Install Pirum
$ pear channel-discover pear.pirum-project.org
$ pear install pirum/Pirum-beta
Create a pirum configuration file:
It's called pirum.xml
It goes in the root of your pear repository
It contains:
<?xml version="1.0" encoding="UTF-8" ?> <server> <name>[username].github.com/pear</name> <summary>[username]'s PEAR Channel Server</summary> <alias>[username]</alias> <url>http://[username].github.com/pear</url> </server>
Run the build command
$ pirum build .
Now add and commit everything
$ git add -A
$ git commit -m "Initial server build. Sauce Labs is awesome"
Rename your master branch to gh-pages and push it to GitHub
$ git branch -m master gh-pages
$ git push origin gh-pages
Your PEAR channel server is now available (after maybe 15 minutes) under [username].github.com/pear
. Test it out!
$ pear channel-discover [username].github.com/pear
$ pear channel-info [username]
$ pear list-all -c [username]
There! Now you have a pear channel. Now you need to
Go to the directory that contains your PHP files
Create a package.xml file that contains metadata about your package
Check that it's a valid package
$ pear package-validate
Make the package!
$ pear package
(this should create a .tgz file that's named after the package you detailed in package.xml)
Woo! Now you have a package and a channel. Next step is to
Copy the .tgz file to your pear repository
Navigate to that directory
Add the package to the channel locally
$ pirum add . [filename].tgz
Upload the changes to github! Note that you push to gh-pages and not to master.
$ git add -A
$ git commit -m "Added first version of my pear package. Sauce Labs is awesome"
$ git push origin gh-pages
And you're done! No more bullets! Or numbered lists. Now the whole world is exposed to your PHP. Hopefully that's a good thing. Here’s our Pear channel: https://github.com/saucelabs/pear Here’s the source we distribute through it: https://github.com/saucelabs/phpunit-selenium-sauceondemand Special thanks to Jan Sorgalla for showing me by example how to do all this.