PHP code example of cetver / yii2-language-url-manager
1. Go to this page and download the library: Download cetver/yii2-language-url-manager 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/ */
cetver / yii2-language-url-manager example snippets
return [
'components' => [
'urlManager' => [
'class' => 'cetver\LanguageUrlManager\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
/*
* The list of available languages.
*/
'languages' => ['en', 'ru'],
/*
or
'languages' => function () {
return \app\models\Language::find()->select('code')->column();
},
*/
/*
* - true: processes the URL like "en.example.com"
* - false: processes the URL like "example.com/en"
* NOTE: If this property set to true, the domain containing a language, must be the first on the left side,
* for example:
* - en.it.example.com - is valid
* - it.en.example.com - is invalid
*/
'existsLanguageSubdomain' => false,
/*
* The regular expression patterns list, applied to path info, if there are matches, the request,
* containing a language, will not be processed.
* For performance reasons, the blacklist does not applied for URL creation (Take a look at an example).
* @see \yii\web\Request::getPathInfo()
* An example:
*
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.