PHP code example of district5 / minimum-version

1. Go to this page and download the library: Download district5/minimum-version library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

district5 / minimum-version example snippets


use District5\MinimumVersion\Slim\Slim4Middleware;

$app->add(
    Slim4Middleware::fromValues(
        '1.0.0', // Minimum version to accept
        ['0.9.9', '1.0.0'], // Explicitly allowed versions
        'X-Api-Version' // Header name to check version against, defaults to 'X-Version'
    )
);

use District5\MinimumVersion\Slim\Slim4Middleware;

$app->add(
    Slim4Middleware::fromEnv(
        'MINIMUM_VERSION', // Environment variable name for minimum version, e.g. '1.0.0'
        'ALLOWED_VERSIONS', // Environment variable name for allowed versions, comma-separated, e.g. '0.0.9, 1.0.0'
        Slim4Middleware::VERSION_HEADER // This is the default value of 'X-Version'. The header name to check version
    )
);