Specifying system requirements

Contents...

If your app or plugin sets certain requirements to the server environment, you need to specify them in file lib/config/requirements.php inside the subdirectory of your app or plugin. Such a requirement may be availability of an installed Webasyst app or a PHP extension, or some certain value of PHP configuration parameter.

System requirements must be specified in the form of a PHP file returning an associative array with the names of required resources as its keys and the following data in subarrays:

name: resource name
description: its description or explanation why it is required
strict: whether it is strictly required (Boolean parameter; if true is specified then users will not be able to install or update your product until the corresponding requirement is satisfied)
version/value: version number or required value (this item should must be omitted for server components; e.g., PHP extensions). Values of fields version/value support use of comparison operators: > , > =, =, <=, <. If comparison operator is not specified then the specified version of a server component is considered as the lowest acceptable version and the value of a server parameter — as its the minimal acceptable value. For the PHP version, a comparison operator is required.

Supported types of system requirements:

  • app.%app_id%: ID of an installed Webasyst app; e.g., app.stickies
  • php.%php_extension_name%: name of a PHP extension; e.g., php.domxml
  • phpini.%php_parameter_name%: name of a PHP configuration parameter; e.g., phpini.allow_url_fopen
  • php: PHP version

Below are examples of specifying system requirements in file requirements.php:

<?php

return [
    'app.installer'= > [
        'name'= > 'Webasyst framework',
        'description'= > '',
        'strict'= > true,
        'version'= > '1.0.0.7',
        // latest framework version requirement
        // 'version'= > 'latest',
    ],
    'app.stickies'= > [
        'name'= > 'Stickies app',
        'description'= > '',
        'strict'= > true,
        'version'= > '1.0.0.7',
    ],
    'php.curl'= > [
        'name'= > 'cURL',
        'description'= > 'Data exchange with external web servers',
        'strict'= > true,
    ],
    'phpini.max_exection_time'= > [
        'name'= > 'Maximum execution time for PHP scripts',
        'description'= > '',
        'strict'= > false,
        'value'= > ' > 60',
    ],
    'php'= > [
        'strict'= > true,
        'version'= > ' > =8.0',
    ],
];
System requirements specified in file requirements.php are used only for the basic verification of whether the server environment is suitable for installation of your app or plugin. Irrespective of the system requirements specified in that file, you need to develop your product in such a way that it takes possible changes of server configuration into account, which may take place after installation or the last update, and runs corresponding checks whenever it is crucial for the operation of you product.