Skip to content

Instantly share code, notes, and snippets.

@diversen
Last active December 31, 2016 16:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diversen/d628310ff3fd0255620efbf3c096cae6 to your computer and use it in GitHub Desktop.
Save diversen/d628310ff3fd0255620efbf3c096cae6 to your computer and use it in GitHub Desktop.
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