PHP code example of devgroup / yii2-multilingual

1. Go to this page and download the library: Download devgroup/yii2-multilingual 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/ */

    

devgroup / yii2-multilingual example snippets


<?= \DevGroup\Multilingual\widgets\HrefLang::widget() 

php composer.phar 
 php
use DevGroup\Multilingual\behaviors\MultilingualActiveRecord;
use DevGroup\Multilingual\traits\MultilingualTrait;

/**
 * Class Post
 * @property integer $author_id
 */
class Post extends \yii\db\ActiveRecord
{
    use MultilingualTrait;

    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'multilingual' => [
                'class' => MultilingualActiveRecord::className(),
                'translationPublishedAttribute' => 'is_active',
            ],
        ];
    }


    public static function tableName()
    {
        return '{{%post}}';
    }
}