Skip to content
This repository has been archived by the owner on Sep 6, 2020. It is now read-only.
kherge edited this page Jul 6, 2012 · 16 revisions

To configure Box for your PHP ARchive (PHAR), you will need to create a box.json file.

box.json

This is an example box.json file that uses all of the available settings.

{
    "algorithm": 2,
    "alias": "example.phar",
    "base-path": "/path/to/app",
    "directories": [
        "dir/one",
        "dir/two"
    ],
    "files": [
        "file/one.php",
        "file/two.php"
    ],
    "finder": [
        {
            "name": "*.php",
            "in": "lib/one"
        },
        {
            "name": "*.php",
            "exclude": "Tests",
            "in": "lib/one"
        }
    ],
    "git-version": "package_version",
    "main": "bin/main.php",
    "output": "example.phar",
    "replacements": {
        "tag1": "Value 1",
        "tag2": "Value 2"
    },
    "stub": "src/stub.php"
}

algorithm

The algorithm option is used to set what signature algorithm you want to use. By default, this option is set to Phar::SHA1. You may find other available algorithms at the Phar constants page. The decimal value of the constant is expected in the configuration file. You can use the following table as a guide:

  • Phar::MD5: 1
  • Phar::SHA1: 2
  • Phar::SHA256: 3
  • Phar::SHA512: 4
  • Phar::OPENSSL: 5

A request has been opened for a better way of setting algorithms.

A request has been opened to support using OpenSSL for signing.

alias

The alias is the name of the stream used for loading files from within the PHAR. The name of the alias is registered using the Phar::mapPhar() method when used with the Box generated stub. The default alias is default.phar.

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

    Phar::mapPhar('default.phar');

    __HALT_COMPILER();

base-path

directories

files

finder

git-version

main

output

replacements

stub

Clone this wiki locally