PHP code example of oorrwullie / yii2-babelfishfood
1. Go to this page and download the library: Download oorrwullie/yii2-babelfishfood 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/ */
oorrwullie / yii2-babelfishfood example snippets
'components' => [
'babelfishfood' => [
'class' => 'oorrwullie\babelfishfood\components\BFFComponent',
'cookieName' => 'language', // Name of the cookie.
'cookieDomain' => 'example.com', // Domain of the cookie.
'expireDays' => 64, // The expiration time of the cookie is 64 days.
'callback' => function() {
if (!\Yii::$app->user->isGuest) {
$user = \Yii::$app->user->identity;
$user->language = \Yii::$app->language;
$user->save();
}
}
]
]