Setup Github and Packagist on Mac

Well, I think I’m going to try making an open source zf2 module, to see if I can ūüôā
Essentially a basic static page module for sorting out all your boring non-dynamic pages! (about us, privacy policy, terms and conditions, that kind of thing!)

Okay, so first up you need a github account. Github is free so long as any code you put up there is open source. Activate your account and create a repository. In my case it was

Now you need to set up git. The instructions on the website didn’t quite work and I had to IRC some guys at #github to get pointed in the right direction. But for the most part it worked, so follow these instructions:¬†

Next thing we clone the repository to your machine. go to whichever folder you want to keep your work in, and type the equivalent of this:

git clone git:// static-content
cd static-content

And we’re in our project. In order to use composer with our repository, we need a packagist account, so sign up at¬† And we create a composer.json file :

    "name": "delboy1978uk/static-content",
    "description": "Module for serving up static pages",
    "type": "library",
    "keywords": [
    "homepage": "",
    "authors": [
        "name": "Derek Stephen McLean",
        "email": ""
        "php": ">=5.3.3",
        "zendframework/zendframework": "2.*"
            "StaticContent": "src/"
        "classmap": [
So we add that file, and commit, and push.
git add .
git commit -a
git push origin master
If you get some error about cannot push, (I did, it said: You can’t push to git:// then you need to go to your github page. You will see a text box with an https:// address. Copy the address, and then edit your .git/config replacing the git:// one with the https:// one you just copied. Then try pushing again, and it should work.
Go to your packagist account, and paste the repo address in there (click submit package). Once it’s been added you’ll see it doesn’t auto update. Click on your user name at the top right, it will take you to a page with an API key. Copy this key and go back to your github repo, and click admin at the top right. On the following page, click service hooks in the left hand side column. Enter¬† as the host, your packagist user name, and the pi token you copied. Once thats done, packagist will now update when you push to github.
Okay, so now to test!
Go into one of your projects that use composer (in my case a Zend Framework 2 Application), and in the composer.json add the following (or similar) in the require part:
"delboy1978uk/static-content": "dev-master"
Finally, type in
php composer.phar update
And lo and behold, my package is auto installed into our application!! Awesome! Now I just need to make this package worth adding in the first place lol!
Have fun!