PHP code example of wiisoft / yii2-materialize

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

    

wiisoft / yii2-materialize example snippets


use wii\materialize\Nav;
use wii\materialize\NavBar;

NavBar::begin(['brandLabel' => 'NavBar Test']);
echo Nav::widget([
    'items' => [
        ['label' => 'Home', 'url' => ['/site/index']],
        ['label' => 'About', 'url' => ['/site/about']],
    ],
]);
NavBar::end();


echo Nav::widget([
    'items' => [
        [
            'label' => 'Home',
            'url' => ['site/index'],
            'linkOptions' => [...],
        ],
        [
            'label' => 'Dropdown',
            'items' => [
                 ['label' => 'Level 1 - Dropdown A', 'url' => '#'],
                 '<li class="divider"></li>',
                 '<li class="dropdown-header">Dropdown Header</li>',
                 ['label' => 'Level 1 - Dropdown B', 'url' => '#'],
            ],
        ],
    ],
    'options' => ['class' =>'nav-pills'], // set this to nav-tab to get tab-styled navigation
]);

echo Nav::widget([
    'items' => [
        [
            'label' => 'Home',
            'url' => ['site/index'],
            'linkOptions' => [...],
        ],
        [
            'label' => 'Dropdown',
            'items' => [
                 ['label' => 'Level 1 - Dropdown A', 'url' => '#'],
                 '<li class="divider"></li>',
                 '<li class="dropdown-header">Dropdown Header</li>',
                 ['label' => 'Level 1 - Dropdown B', 'url' => '#'],
            ],
        ],
    ],
    'mobileItems'=>[
        [
            'label' => 'Home',
            'url' => ['site/index'],
            'linkOptions' => [],
        ],
        [
            'label' => 'Articles',
            'url' => ['service/articles']
        ],
        [
            'label' => 'Contacts',
            'url' => ['service/contacts']
        ]
     ],
    'options' => ['class' =>'nav-pills'], // set this to nav-tab to get tab-styled navigation
]);
                                    
echo Badge::widget([                      
    'label' => 'Action',                  
    'options' => ['class' => 'new'],      
]);                                       
                                     
echo Button::widget([                      
    'label' => 'Action',                   
    'options' => ['class' => 'btn-large'], 
]);                                        
                                                                                  
echo Slider::widget([                                                                    
        'items' =>[
            [
                'img' => "/tmp/1b.jpg",
                'imgOptions' => ['alt' => 'Test', 'Title' => 'Title', 'class' => 'myClass'],
                'title' => "Left Aligned Caption",
                'titleOptions' =>['id' => 'id', 'class' => 'titleClass'],
                'smallTitle' => "Here's our small slogan.",
                'smallTitleOptions' => ['class' => 'light grey-text text-lighten-3'],
                'itemOptions' => ['class' => 'center-align'],

            ],
            [
                'img' => "/tmp/2b.jpg",
                'title' => "Left Aligned Caption",
                'smallTitle' => "Here's our small slogan.",
                'smallTitleOptions' => ['class' => 'light grey-text text-lighten-3'],
                'itemOptions' => ['class' => 'left-align']
            ],
            [
                'img' => "/tmp/3b.jpg",
                'title' => "Left Aligned Caption",
                'smallTitle' => "Here's our small slogan.",
                'smallTitleOptions' => ['class' => 'light grey-text text-lighten-3'],
                'itemOptions' => ['class' => 'right-align']
            ],
        ],
        'options'=>['id'=>'options'],
        'slidesOptions'=>['class'=>'slidesOptions'],                                                                  
                                                                                  
echo Card::widget([                                                                                       
  'item' => [                                                                                             
             'img' => '/tmp/3.jpg',                                                                       
             'imgOptions' => ['class' => 'imgOptions', 'id' => 'imgOptions'],                             
             'cardImgOptions' => ['class' => 'cardImgOptions', 'id' => 'cardImgOptions'],                 
             'cardContentOptions' => ['class' => 'cardContentOptions', 'id' => 'cardContentOptions'],     
             'cardTitle'=>'Card Title',                                                                   
             'cardTitleOptions'=>['class'=>'cardTitleOptions','id'=>'cardTitleOptions'],                  
             'cardContent' => [                                                                           
                  [                                                                                       
                  'tag' => 'p',                                                                           
                  'body' => 'I am a very simple card. I am good at containing small bits of information.  
                  I am convenient because I    'body' => '<a href="#">This is a link</a>'                                           
                 ],                                                                                       
             ],                                                                                           
             'cardAction' => [                                                                            
                  [                                                                                       
                  'tag' => 'span',                                                                        
                  'body' => '<a href="#">This is a link</a>'                                              
                  ],                                                                                      
                 [                                                                                        
                 'tag' => 'span',                                                                         
                 'body' => '<a href="#">This is a link</a>'                                               
                 ],                                                                                       
             ],                                                                                           
         ],                                                                                               
     'options' => ['class' => 'wow bounceIn']                                                             
 ]);                                                                                                                                                                        

php composer.phar