PHP code example of black-lamp / yii2-file-icons

1. Go to this page and download the library: Download black-lamp/yii2-file-icons 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/ */

    

black-lamp / yii2-file-icons example snippets


$widget = \bl\files\icons\FileIconWidget::begin([
    'icons' => [
        'txt' => [
            'icon' => \yii\helpers\Html::tag('i', '', ['class' => 'icon-file-txt'])
        ],
        'groups' => [
            [
                'extensions' => ['jpg', 'png', 'gif'],
                'icon' => \yii\helpers\Html::tag('i', '', ['class' => 'icon-picture'])
            ],
        ]
    ]
]);
echo $widget->getIcon('image.jpg');
$widget->end();

IconHelper::icon('text');
IconHelper::icon('pdf');
IconHelper::icon('power-point');
IconHelper::icon('archive');
IconHelper::icon('word');
IconHelper::icon('excel');
IconHelper::icon('picture');
IconHelper::icon('video');
IconHelper::icon('code');