PHP code example of tomaivanovtomov / yii2-slider

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

    

tomaivanovtomov / yii2-slider example snippets


'modules' => [
    ....
    'user' => [
        'class' => 'tomaivanovtomov\slider\Module',
    ],
    ....
],

\tomaivanovtomov\revolution\Assets::register($this);


    public static function getSliderImages()
    {
        return \tomaivanovtomov\slider\models\Slide::find()
            ->joinWith('translation')
            ->select(['slide.id', 'slideLang.title', 'slide.filename'])
            ->where('slideLang.language=:lang', [':lang' => Yii::$app->language])
            ->all();
    } 

    echo \tomaivanovtomov\slider\widgets\Slider::widget([
        'slides' => \tomaivanovtomov\slider\models\Slide::getSliderImages(),
        'height' => 400,
        'options' => [
            'items' => 1
        ]
    ]);


'language-information' => [
    'BG' => [
        'title' => 'Български',
        'extension' => 'bg',
    ],
    'EN' => [
        'title' => 'English',
        'extension' => 'en',
    ],
],
'languageDefault' => 'bg'
bash
php yii migrate/up --migrationPath=@vendor/tomaivanovtomov/yii2-slider/migrations