Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
notes about phar-composer

phar-composer example

Create a composer dir called pgit

Create a composer.json file inside this dir containing:

{
    "require": {
        "diversen/minimal-cli-framework": "^1.1"
    },
    "bin": [
        "pgit"
    ]
}

Create a pgit file inside the pgit dir, which should contain:

#!/usr/bin/env php
<?php

echo "hello world\n";

Build this using phar-composer (outside pgit dir)

phar-composer.phar build pgit

You now have an executable called

pgit.phar

Execute it:

./pgit.phar

It should say: hello world

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment