Skip to content

Inspect

Once you've built your PHP Archive, you'll be happy to retrieve easily what manifests are embedded, and what formats are available.

This is the goal of the new inspect command.

PHAR without manifests

Pre-Condition

Suppose you've built BOX Manifest with the box.json config file

{
    "main": "bin/box-manifest",
    "alias": "box-manifest-alias.phar",
    "compression": "GZ",
    "blacklist": [
        "fixtures",
        "tests",
        "Test",
        "doc",
        "dist",
        "vendor-bin"
    ],
    "directories": ["bin", "src", "vendor"],
    "directories-bin": [
        "vendor/humbug/box/res/requirement-checker",
        "resources"
    ],
    "files": [
        "autoload.php",
        "bootstrap.php"
    ],
    "files-bin": [
        "vendor/humbug/php-scoper/vendor-hotfix/.gitkeep"
    ],
    "stub": "stub.php"
}

The stub setting is necessary if you want to invoke the PHAR with --manifest option, whatever there are or not, some manifests available !

box-manifest make compile -c box.json
vendor/bin/box compile -c box.json

Inspection results

box-manifest inspect bin/box-manifest.phar

none manifests

PHAR with manifests

Pre-Condition

Suppose you've built BOX Manifest with the box.json.dist config file

{
    "main": "bin/box-manifest",
    "alias": "box-manifest-alias.phar",
    "compression": "GZ",
    "blacklist": [
        "fixtures",
        "tests",
        "Test",
        "doc",
        "dist",
        "vendor-bin"
    ],
    "directories": [
        "bin",
        "src",
        "vendor"
    ],
    "directories-bin": [
        "vendor/humbug/box/res/requirement-checker",
        "resources"
    ],
    "files": [
        "autoload.php",
        "bootstrap.php"
    ],
    "files-bin": [
        "vendor/humbug/php-scoper/vendor-hotfix/.gitkeep",
        "console-table.txt",
        "plain.txt",
        "sbom.json",
        ".box.manifests.bin"
    ],
    "stub": "stub.php",
    "dump-autoload": false,
    "map": [
        {
            "console-table.txt": ".box.manifests/console-table.txt"
        },
        {
            "plain.txt": ".box.manifests/plain.txt"
        },
        {
            "sbom.json": ".box.manifests/sbom.json"
        }
    ]
}

Three manifests in different format, and meta-data file (.box.manifests.bin) are referenced by files-bin settting, and store inside PHAR on .box.manifests/ folder by map setting.

box-manifest make compile -c box.json.dist
vendor/bin/box compile -c box.json.dist

Inspection results

box-manifest inspect bin/box-manifest.phar

some manifests

Tip

Remember that when you'll invoke the PHAR distribution with --manifest option (and no value), you'll show only the default (first one in list).

In this context, we will display contents of console-table.txt file.

For others, specify which one, with either :

Plain text format

bin/box-manifest.phar --manifest plain.txt

CycloneDX SBOM JSON format

bin/box-manifest.phar --manifest sbom.json