diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/4.x/404.html b/4.x/404.html new file mode 100644 index 0000000..316edd1 --- /dev/null +++ b/4.x/404.html @@ -0,0 +1,974 @@ + + + +
+ + + + + + + + + + + + + + + + +Before to compile your PHP Archive (PHAR) with the BOX tool, +you need to have a BOX configuration file that :
+files-bin
setting.map
setting.Tip
+You can complete an existing configuration file, rather than building a new one from scratch.
+Don't forget to specify option --config /path/to/any-box.json
on following command invocations.
To do so, you have to specify --resource
(-r
shortcut) option with filename that should be previously built (or not).
Tip
+If you want to keep your manifests store in root of the PHP Archive, please specify --resource-dir '/'
stub
BOX setting)To do so, you have to specify --output-stub
option with filename that should be previously built (or not).
Of course running CLI commands to verify contents is not so hard. For example:
+ +But we may expect a better user experience. Adding a --manifest
option that will be able to :
Make for example this stub (see Output tab), either manually or with the following command.
+<?php
+
+// default stub template @generated by BOX Manifest 4.x-dev@3eff4eb
+
+$withManifest = array_search('--manifest', $argv);
+$withoutAnsi = array_search('--no-ansi', $argv);
+
+if ($withManifest !== false) {
+ $manifestDir = '.box.manifests/';
+ $resources = (($argc - 1 > $withManifest) && !str_starts_with($argv[$withManifest + 1], '-')) ? [$argv[$withManifest + 1]] : ['console.txt', 'manifest.txt'];
+
+ foreach ($resources as $resource) {
+ $res = str_replace($manifestDir, '', $resource);
+ $filename = "phar://" . __FILE__ . "/{$manifestDir}{$res}";
+ if (file_exists($filename)) {
+ $manifest = file_get_contents($filename);
+ if ($withoutAnsi !== false) {
+ $manifest = preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $manifest);
+ }
+ echo $manifest, PHP_EOL;
+ exit(0);
+ } elseif (count($resources) === 1) {
+ echo sprintf('Manifest "%s" is not available in this PHP Archive.', $resource), PHP_EOL;
+ exit(2);
+ }
+ }
+ echo 'No manifest found in this PHP Archive', PHP_EOL;
+ exit(1);
+}
+
+
+
+// No PHAR config
+
+__HALT_COMPILER(); ?>
+
Note
+Default template resources/default_stub.template
is used, but you can make your own if you want to change behaviour.
In this case, specify the --template /path/to/your/template
option in previous command. For example:
Declare it in your BOX config file, with excerpt :
+ +Then compile your PHP Archive.
+ You are now able to display either the first manifest available (console.txt
is included and is on top of priority list)
Or the second manifest available (manifest.txt
)
And if you ask for an unavailable manifest into the PHP Archive,
+ + + + + + + + + + + + + + +In this tutorial we will build a manifest in two formats (SBOM XML and ANSI text).
+First we will build a SBOM XML version following default (CycloneDX) specification 1.6
+<?xml version="1.0" encoding="UTF-8"?>
+<bom xmlns="http://cyclonedx.org/schema/bom/1.6" version="1" serialNumber="urn:uuid:ad64fd89-99e9-4976-b9d2-6ec4e88b4b15">
+ <metadata>
+ <timestamp><![CDATA[2024-08-07T04:23:01Z]]></timestamp>
+ <tools>
+ <tool>
+ <vendor><![CDATA[box-project]]></vendor>
+ <name><![CDATA[box]]></name>
+ <version><![CDATA[4.6.2@29c3585]]></version>
+ </tool>
+ <tool>
+ <vendor><![CDATA[bartlett]]></vendor>
+ <name><![CDATA[box-manifest]]></name>
+ <version><![CDATA[4.x-dev@3eff4eb]]></version>
+ </tool>
+ </tools>
+ <properties>
+ <property name="specVersion"><![CDATA[1.6]]></property>
+ <property name="bomFormat"><![CDATA[CycloneDX]]></property>
+ </properties>
+ </metadata>
+ <components>
+ <component type="library" bom-ref="pkg:composer/psr/log@3.0.0">
+ <group><![CDATA[psr]]></group>
+ <name><![CDATA[log]]></name>
+ <version><![CDATA[3.0.0]]></version>
+ <purl><![CDATA[pkg:composer/psr/log@3.0.0]]></purl>
+ </component>
+ </components>
+ <dependencies>
+ <dependency ref="pkg:composer/psr/log@3.0.0"/>
+ </dependencies>
+</bom>
+
Next we will build a decorated TEXT version
+Now its turn to declare these files to the BOX config file, with :
+ +In Part 3 of the tutorial, we will see how to dynamically add it without introduced errors.
+Then finally, compile your PHP Archive with box compile
command,
+the metadata contents is only used as fallback contents in case you forgot to declare files-bin
entries.
____
+ / __ )____ _ __
+ / __ / __ \| |/_/
+ / /_/ / /_/ /> <
+/_____/\____/_/|_|
+
+
+Box version 4.6.2@29c3585
+
+ // Loading the configuration file "app-fixtures.box.json.dist".
+
+🔨 Building the PHAR "/shared/backups/bartlett/box-manifest/examples/app-fixtures/app-fixtures.phar"
+
+? Checking Composer compatibility
+ > Supported version detected
+? No compactor to register
+? Adding main file: /shared/backups/bartlett/box-manifest/examples/app-fixtures/index.php
+? Adding requirements checker
+? Adding binary files
+ > 36 file(s)
+? Auto-discover files? No
+? Exclude dev files? Yes
+? Adding files
+ > 25 file(s)
+? Using stub file: /shared/backups/bartlett/box-manifest/examples/app-fixtures/app-fixtures-stub.php
+? Dumping the Composer autoloader
+? Removing the Composer dump artefacts
+? Compressing with the algorithm "GZ"
+ > Warning: the extension "zlib" will now be required to execute the PHAR
+? Setting file permissions to 0755
+* Done.
+
+No recommendation found.
+⚠️ 1 warning found:
+ - The "alias" setting has been set but is ignored since a custom stub path is used
+
+ // PHAR: 60 files (48.53KB)
+ // You can inspect the generated PHAR with the "info" command.
+
+ // Memory usage: 12.85MB (peak: 13.30MB), time: <1sec
+
On this tutorial we will use the sources from examples/app-fixtures
directory.
You can read each part in any particular order, even if it's recommended to follow them one after others.
+In this lesson, you will learn how to build manifest files in different format.
+In this lesson, you will learn how to generate a custom stub that will be in charge to display your manifests at runtime.
+In this lesson, you will learn how to generate a BOX configuration file with all settings required to handle your manifests at runtime.
+ + + + + + + + + + + + + +console
symfony table formatImportant
+These commands and results are applied from examples/app-fixtures
immutable demo folder.
+Must be your current working directory.
Warning
+Additional free format is in charge of User to implement it.
+This class should implement the Bartlett\BoxManifest\Composer\ManifestBuilderInterface
contract and must be loadable,
+either by your autoloader or with bootstrap helper feature (see --bootstrap|-b
option).
<?php return array(
+ 'root' => array(
+ 'name' => 'root/app-fixtures',
+ 'pretty_version' => '3.x-dev',
+ 'version' => '3.9999999.9999999.9999999-dev',
+ 'reference' => '966188206a550366b0e3fe30b6722a16d2246bce',
+ 'type' => 'library',
+ 'install_path' => __DIR__ . '/../../',
+ 'aliases' => array(),
+ 'dev' => true,
+ ),
+ 'versions' => array(
+ 'psr/log' => array(
+ 'pretty_version' => '3.0.0',
+ 'version' => '3.0.0.0',
+ 'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001',
+ 'type' => 'library',
+ 'install_path' => __DIR__ . '/../psr/log',
+ 'aliases' => array(),
+ 'dev_requirement' => true,
+ ),
+ 'root/app-fixtures' => array(
+ 'pretty_version' => '3.x-dev',
+ 'version' => '3.9999999.9999999.9999999-dev',
+ 'reference' => '966188206a550366b0e3fe30b6722a16d2246bce',
+ 'type' => 'library',
+ 'install_path' => __DIR__ . '/../../',
+ 'aliases' => array(),
+ 'dev_requirement' => false,
+ ),
+ ),
+);
+
Important
+These commands and results are applied from examples/app-fixtures
immutable demo folder.
+Must be your current working directory.
array (
+ 'root' =>
+ array (
+ 'name' => 'root/app-fixtures',
+ 'pretty_version' => '3.x-dev',
+ 'version' => '3.9999999.9999999.9999999-dev',
+ 'reference' => '966188206a550366b0e3fe30b6722a16d2246bce',
+ 'type' => 'library',
+ 'install_path' => '/shared/backups/bartlett/box-manifest/examples/app-fixtures/vendor/composer/../../',
+ 'aliases' =>
+ array (
+ ),
+ 'dev' => true,
+ ),
+ 'versions' =>
+ array (
+ 'psr/log' =>
+ array (
+ 'pretty_version' => '3.0.0',
+ 'version' => '3.0.0.0',
+ 'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001',
+ 'type' => 'library',
+ 'install_path' => '/shared/backups/bartlett/box-manifest/examples/app-fixtures/vendor/composer/../psr/log',
+ 'aliases' =>
+ array (
+ ),
+ 'dev_requirement' => true,
+ ),
+ 'root/app-fixtures' =>
+ array (
+ 'pretty_version' => '3.x-dev',
+ 'version' => '3.9999999.9999999.9999999-dev',
+ 'reference' => '966188206a550366b0e3fe30b6722a16d2246bce',
+ 'type' => 'library',
+ 'install_path' => '/shared/backups/bartlett/box-manifest/examples/app-fixtures/vendor/composer/../../',
+ 'aliases' =>
+ array (
+ ),
+ 'dev_requirement' => false,
+ ),
+ ),
+)
+
array (
+ 'root' =>
+ array (
+ 'name' => 'root/app-fixtures',
+ 'pretty_version' => '3.x-dev',
+ 'version' => '3.9999999.9999999.9999999-dev',
+ 'reference' => '966188206a550366b0e3fe30b6722a16d2246bce',
+ 'type' => 'library',
+ 'install_path' => '/shared/backups/bartlett/box-manifest/examples/app-fixtures/vendor/composer/../../',
+ 'aliases' =>
+ array (
+ ),
+ 'dev' => true,
+ ),
+ 'versions' =>
+ array (
+ 'psr/log' =>
+ array (
+ 'pretty_version' => '3.0.0',
+ 'version' => '3.0.0.0',
+ 'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001',
+ 'type' => 'library',
+ 'install_path' => '/shared/backups/bartlett/box-manifest/examples/app-fixtures/vendor/composer/../psr/log',
+ 'aliases' =>
+ array (
+ ),
+ 'dev_requirement' => true,
+ ),
+ 'root/app-fixtures' =>
+ array (
+ 'pretty_version' => '3.x-dev',
+ 'version' => '3.9999999.9999999.9999999-dev',
+ 'reference' => '966188206a550366b0e3fe30b6722a16d2246bce',
+ 'type' => 'library',
+ 'install_path' => '/shared/backups/bartlett/box-manifest/examples/app-fixtures/vendor/composer/../../',
+ 'aliases' =>
+ array (
+ ),
+ 'dev_requirement' => false,
+ ),
+ ),
+)
+
ansi
(decorated) TEXT formatImportant
+These commands and results are applied from examples/app-fixtures
immutable demo folder.
+Must be your current working directory.
plain
TEXT formatImportant
+These commands and results are applied from examples/app-fixtures
immutable demo folder.
+Must be your current working directory.
sbom
JSON formatImportant
+These commands and results are applied from examples/app-fixtures
immutable demo folder.
+Must be your current working directory.
{
+ "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
+ "bomFormat": "CycloneDX",
+ "specVersion": "1.6",
+ "serialNumber": "urn:uuid:bb11a687-9725-4c28-b8c0-1a15377274b5",
+ "version": 1,
+ "metadata": {
+ "timestamp": "2024-08-10T17:49:14Z",
+ "tools": [
+ {
+ "vendor": "box-project",
+ "name": "box",
+ "version": "4.6.2@29c3585"
+ },
+ {
+ "vendor": "bartlett",
+ "name": "box-manifest",
+ "version": "4.x-dev@3eff4eb"
+ }
+ ],
+ "properties": [
+ {
+ "name": "specVersion",
+ "value": "1.6"
+ },
+ {
+ "name": "bomFormat",
+ "value": "CycloneDX"
+ }
+ ]
+ },
+ "components": [
+ {
+ "bom-ref": "pkg:composer/psr/log@3.0.0",
+ "type": "library",
+ "name": "log",
+ "version": "3.0.0",
+ "group": "psr",
+ "purl": "pkg:composer/psr/log@3.0.0"
+ }
+ ],
+ "dependencies": [
+ {
+ "ref": "pkg:composer/psr/log@3.0.0"
+ }
+ ]
+}
+
{
+ "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
+ "bomFormat": "CycloneDX",
+ "specVersion": "1.6",
+ "serialNumber": "urn:uuid:bb11a687-9725-4c28-b8c0-1a15377274b5",
+ "version": 1,
+ "metadata": {
+ "timestamp": "2024-08-10T17:49:14Z",
+ "tools": [
+ {
+ "vendor": "box-project",
+ "name": "box",
+ "version": "4.6.2@29c3585"
+ },
+ {
+ "vendor": "bartlett",
+ "name": "box-manifest",
+ "version": "4.x-dev@3eff4eb"
+ }
+ ],
+ "properties": [
+ {
+ "name": "specVersion",
+ "value": "1.6"
+ },
+ {
+ "name": "bomFormat",
+ "value": "CycloneDX"
+ }
+ ]
+ },
+ "components": [
+ {
+ "bom-ref": "pkg:composer/psr/log@3.0.0",
+ "type": "library",
+ "name": "log",
+ "version": "3.0.0",
+ "group": "psr",
+ "purl": "pkg:composer/psr/log@3.0.0"
+ }
+ ],
+ "dependencies": [
+ {
+ "ref": "pkg:composer/psr/log@3.0.0"
+ }
+ ]
+}
+
sbom
XML formatImportant
+These commands and results are applied from examples/app-fixtures
immutable demo folder.
+Must be your current working directory.
<?xml version="1.0" encoding="UTF-8"?>
+<bom xmlns="http://cyclonedx.org/schema/bom/1.6" version="1" serialNumber="urn:uuid:1c9c48eb-ab0f-4f57-96d5-d6640ec8cbf6">
+ <metadata>
+ <timestamp><![CDATA[2024-08-10T17:52:54Z]]></timestamp>
+ <tools>
+ <tool>
+ <vendor><![CDATA[box-project]]></vendor>
+ <name><![CDATA[box]]></name>
+ <version><![CDATA[4.6.2@29c3585]]></version>
+ </tool>
+ <tool>
+ <vendor><![CDATA[bartlett]]></vendor>
+ <name><![CDATA[box-manifest]]></name>
+ <version><![CDATA[4.x-dev@3eff4eb]]></version>
+ </tool>
+ </tools>
+ <properties>
+ <property name="specVersion"><![CDATA[1.6]]></property>
+ <property name="bomFormat"><![CDATA[CycloneDX]]></property>
+ </properties>
+ </metadata>
+ <components>
+ <component type="library" bom-ref="pkg:composer/psr/log@3.0.0">
+ <group><![CDATA[psr]]></group>
+ <name><![CDATA[log]]></name>
+ <version><![CDATA[3.0.0]]></version>
+ <purl><![CDATA[pkg:composer/psr/log@3.0.0]]></purl>
+ </component>
+ </components>
+ <dependencies>
+ <dependency ref="pkg:composer/psr/log@3.0.0"/>
+ </dependencies>
+</bom>
+
<?xml version="1.0" encoding="UTF-8"?>
+<bom xmlns="http://cyclonedx.org/schema/bom/1.6" version="1" serialNumber="urn:uuid:1c9c48eb-ab0f-4f57-96d5-d6640ec8cbf6">
+ <metadata>
+ <timestamp><![CDATA[2024-08-10T17:52:54Z]]></timestamp>
+ <tools>
+ <tool>
+ <vendor><![CDATA[box-project]]></vendor>
+ <name><![CDATA[box]]></name>
+ <version><![CDATA[4.6.2@29c3585]]></version>
+ </tool>
+ <tool>
+ <vendor><![CDATA[bartlett]]></vendor>
+ <name><![CDATA[box-manifest]]></name>
+ <version><![CDATA[4.x-dev@3eff4eb]]></version>
+ </tool>
+ </tools>
+ <properties>
+ <property name="specVersion"><![CDATA[1.6]]></property>
+ <property name="bomFormat"><![CDATA[CycloneDX]]></property>
+ </properties>
+ </metadata>
+ <components>
+ <component type="library" bom-ref="pkg:composer/psr/log@3.0.0">
+ <group><![CDATA[psr]]></group>
+ <name><![CDATA[log]]></name>
+ <version><![CDATA[3.0.0]]></version>
+ <purl><![CDATA[pkg:composer/psr/log@3.0.0]]></purl>
+ </component>
+ </components>
+ <dependencies>
+ <dependency ref="pkg:composer/psr/log@3.0.0"/>
+ </dependencies>
+</bom>
+
plain
TEXT formatansi
(decorated) TEXT formatconsole
symfony table formatSBOM XML
formatSBOM JSON
format