Internally, the metadata representing and describing the package consists of a
monolithic data structure with sequential and associative entries. This page
explains the schema of the environment
part of these entries.
On This Page
PHP
The php
entry describes the environment that the package requires to run.
Version
The version
entry contains the parsed/inflated logical expression that the
current PHP version must satisfy. In addition to the semantic core version, the
expression may consist of the following parts:
- The
&&
and||
operators. - The condition brackets
()
. - One of the signs as prefix before the version core:
!=
not equal.==
equal.>=
bigger than or equal.<=
less than or equal.>
bigger than.<
less than.
For example, Fusion describes the version 8.1.0
without sign in its
production file.
This is shorthand for >=8.1.0 && <9.0.0
, indicating that the PHP version must
be at least 8.1.0
but less than 9.0.0
, as shown below:
$metadata["environment"]["php"]["version"] = [[
// only semantic core version that
// matches the PHP version schema
"major" => "8",
"minor" => "1",
"patch" => "0",
// no optional semantic parts
// empty normalized for common util process
"build" => "",
"release" => "",
// empty/no sign
// no breaking changes
// short for >=8.1.0 && <9.0.0
"sign" => ""
]];
A more complex example, could be an inline expression ==8.1.0 || (>=8.2.0 && !=8.2.5)
,
inflated as follows:
// parsed then
$metadata["environment"]["php"]["version"] = [
[
// only semantic core version that
// matches the PHP version schema
"major" => "8",
"minor" => "1",
"patch" => "0",
// no optional semantic parts
// empty normalized for common util process
"build" => "",
"release" => "",
// is equal to
"sign" => "=="
],
"||", // logical OR
[ // CONDITION brackets to sum up
[
// only semantic core version that
// matches the PHP version schema
"major" => "8",
"minor" => "2",
"patch" => "0",
// no optional semantic parts
// empty normalized for common util process
"build" => "",
"release" => "",
// is greater than
"sign" => ">="
],
"&&", // logical AND
[
// only semantic core version that
// matches the PHP version schema
"major" => "8",
"minor" => "2",
"patch" => "5",
// no optional semantic parts
// empty normalized for common util process
"build" => "",
"release" => "",
// is not equal to
"sign" => "!="
],
]
];
In this example, the logic specifies that the PHP version must either be exactly
8.1.0
or meet the criteria of being greater than or equal to 8.2.0
while
simultaneously not being 8.2.5
. Valid versions would be, such as:
9.0.0
8.2.4
12.0.10
8.1.0
Modules
The modules
entry contains required PHP module names. For example, Fusion
requires the curl
module:
$metadata["environment"]["php"]["modules"] = [
"curl"
];
By default, the value is an empty array.