PHP code example of basteyy / php-localization-middleware

1. Go to this page and download the library: Download basteyy/php-localization-middleware 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/ */

    

basteyy / php-localization-middleware example snippets


    $app->add(new \basteyy\LocalizationMiddleware\LocalizationMiddleware(
        default_language: 'de',                     // Default language
        available_languages: ['de', 'ua', 'en'],    // Supported languages
        patch_requested_url: true,                  // Patch the requested url to remove the language in case there is one
        browser_overwrite_url: false,               // Overwrite the url language with the browser language
        patch_only_exactly_match: false             // Patch requested url only if the language is exactly matched (only when url contain a supported language)
    ));
bash
composer