SymfonyRequirements
extends RequirementCollection
in package
This class specifies all requirements and optional recommendations that are necessary to run the Symfony Standard Edition.
Tags
Table of Contents
Constants
- LEGACY_REQUIRED_PHP_VERSION = '5.3.3'
- REQUIRED_PHP_VERSION = '5.5.9'
Properties
- $requirements : array<string|int, Requirement>
Methods
- __construct() : mixed
- Constructor that initializes the requirements.
- add() : mixed
- Adds a Requirement.
- addCollection() : mixed
- Adds a requirement collection to the current set of requirements.
- addPhpIniRecommendation() : mixed
- Adds an optional recommendation in form of a php.ini configuration.
- addPhpIniRequirement() : mixed
- Adds a mandatory requirement in form of a php.ini configuration.
- addRecommendation() : mixed
- Adds an optional recommendation.
- addRequirement() : mixed
- Adds a mandatory requirement.
- all() : array<string|int, Requirement>
- Returns both requirements and recommendations.
- getFailedRecommendations() : array<string|int, Requirement>
- Returns the recommendations that were not met.
- getFailedRequirements() : array<string|int, Requirement>
- Returns the mandatory requirements that were not met.
- getIterator() : Traversable
- Gets the current RequirementCollection as an Iterator.
- getPhpIniConfigPath() : string|false
- Returns the PHP configuration file (php.ini) path.
- getRecommendations() : array<string|int, Requirement>
- Returns all optional recommendations.
- getRequirements() : array<string|int, Requirement>
- Returns all mandatory requirements.
- hasPhpIniConfigIssue() : bool
- Returns whether a php.ini configuration is not correct.
- getPhpRequiredVersion() : string|false
- Defines PHP required version from Symfony version.
- getRealpathCacheSize() : int
- Loads realpath_cache_size from php.ini and converts it to int.
Constants
LEGACY_REQUIRED_PHP_VERSION
public
mixed
LEGACY_REQUIRED_PHP_VERSION
= '5.3.3'
REQUIRED_PHP_VERSION
public
mixed
REQUIRED_PHP_VERSION
= '5.5.9'
Properties
$requirements
private
array<string|int, Requirement>
$requirements
= array()
Methods
__construct()
Constructor that initializes the requirements.
public
__construct() : mixed
add()
Adds a Requirement.
public
add(Requirement $requirement) : mixed
Parameters
- $requirement : Requirement
-
A Requirement instance
addCollection()
Adds a requirement collection to the current set of requirements.
public
addCollection(RequirementCollection $collection) : mixed
Parameters
- $collection : RequirementCollection
-
A RequirementCollection instance
addPhpIniRecommendation()
Adds an optional recommendation in form of a php.ini configuration.
public
addPhpIniRecommendation(string $cfgName, bool|callable $evaluation[, bool $approveCfgAbsence = false ][, string $testMessage = null ][, string $helpHtml = null ][, string|null $helpText = null ]) : mixed
Parameters
- $cfgName : string
-
The configuration name used for ini_get()
- $evaluation : bool|callable
-
Either a boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
- $approveCfgAbsence : bool = false
-
If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
- $testMessage : string = null
-
The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
- $helpHtml : string = null
-
The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
- $helpText : string|null = null
-
The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
addPhpIniRequirement()
Adds a mandatory requirement in form of a php.ini configuration.
public
addPhpIniRequirement(string $cfgName, bool|callable $evaluation[, bool $approveCfgAbsence = false ][, string $testMessage = null ][, string $helpHtml = null ][, string|null $helpText = null ]) : mixed
Parameters
- $cfgName : string
-
The configuration name used for ini_get()
- $evaluation : bool|callable
-
Either a boolean indicating whether the configuration should evaluate to true or false, or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
- $approveCfgAbsence : bool = false
-
If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false. This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin. Example: You require a config to be true but PHP later removes this config and defaults it to true internally.
- $testMessage : string = null
-
The message for testing the requirement (when null and $evaluation is a boolean a default message is derived)
- $helpHtml : string = null
-
The help text formatted in HTML for resolving the problem (when null and $evaluation is a boolean a default help is derived)
- $helpText : string|null = null
-
The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
addRecommendation()
Adds an optional recommendation.
public
addRecommendation(bool $fulfilled, string $testMessage, string $helpHtml[, string|null $helpText = null ]) : mixed
Parameters
- $fulfilled : bool
-
Whether the recommendation is fulfilled
- $testMessage : string
-
The message for testing the recommendation
- $helpHtml : string
-
The help text formatted in HTML for resolving the problem
- $helpText : string|null = null
-
The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
addRequirement()
Adds a mandatory requirement.
public
addRequirement(bool $fulfilled, string $testMessage, string $helpHtml[, string|null $helpText = null ]) : mixed
Parameters
- $fulfilled : bool
-
Whether the requirement is fulfilled
- $testMessage : string
-
The message for testing the requirement
- $helpHtml : string
-
The help text formatted in HTML for resolving the problem
- $helpText : string|null = null
-
The help text (when null, it will be inferred from $helpHtml, i.e. stripped from HTML tags)
all()
Returns both requirements and recommendations.
public
all() : array<string|int, Requirement>
Return values
array<string|int, Requirement>getFailedRecommendations()
Returns the recommendations that were not met.
public
getFailedRecommendations() : array<string|int, Requirement>
Return values
array<string|int, Requirement>getFailedRequirements()
Returns the mandatory requirements that were not met.
public
getFailedRequirements() : array<string|int, Requirement>
Return values
array<string|int, Requirement>getIterator()
Gets the current RequirementCollection as an Iterator.
public
getIterator() : Traversable
Return values
Traversable —A Traversable interface
getPhpIniConfigPath()
Returns the PHP configuration file (php.ini) path.
public
getPhpIniConfigPath() : string|false
Return values
string|false —php.ini file path
getRecommendations()
Returns all optional recommendations.
public
getRecommendations() : array<string|int, Requirement>
Return values
array<string|int, Requirement>getRequirements()
Returns all mandatory requirements.
public
getRequirements() : array<string|int, Requirement>
Return values
array<string|int, Requirement>hasPhpIniConfigIssue()
Returns whether a php.ini configuration is not correct.
public
hasPhpIniConfigIssue() : bool
Return values
bool —php.ini configuration problem?
getPhpRequiredVersion()
Defines PHP required version from Symfony version.
protected
getPhpRequiredVersion() : string|false
Return values
string|false —The PHP required version or false if it could not be guessed
getRealpathCacheSize()
Loads realpath_cache_size from php.ini and converts it to int.
protected
getRealpathCacheSize() : int
(e.g. 16k is converted to 16384 int)