PHP code example of simialbi / yii2-fontawesome

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

    

simialbi / yii2-fontawesome example snippets



// usage 

use rmrevin\yii\fontawesome\FAS;
use yii\helpers\Html;

/* @var $this \yii\web\View */
/* @var $content string */

$this->beginPage();


use rmrevin\yii\fontawesome\FAS;
// or
// use rmrevin\yii\fontawesome\FAB;
// use rmrevin\yii\fontawesome\FAR;
// or (only in pro version https://fontawesome.com/pro)
// use rmrevin\yii\fontawesome\FAL;
// use rmrevin\yii\fontawesome\FAT;
// use rmrevin\yii\fontawesome\FAK;


// normal use
echo FAS::icon('home');

// icon with additional attributes
echo FAS::icon(
    'arrow-left', 
    ['class' => 'big', 'data-role' => 'arrow']
);

// icon in button
echo Html::submitButton(
    Yii::t('app', '{icon} Save', ['icon' => FAS::icon('check')])
);

// icon with additional methods
echo FAS::icon('cog')->sharp(); // (only in pro version https://fontawesome.com/pro)
echo FAS::icon('cog')->duotone(); // (only in pro version https://fontawesome.com/pro)
echo FAS::icon('cog')->inverse(); // only useful in mask or layer usage
echo FAS::icon('cog')->spin(); 
echo FAS::icon('cog')->pulse();
echo FAS::icon('cog')->reverse(); // only useful with spin or pulse
echo FAS::icon('cog')->beat();
echo FAS::icon('cog')->shake();
echo FAS::icon('cog')->bounce();
echo FAS::icon('cog')->fixedWidth(); // or ->fw()
echo FAS::icon('cog')->border();
echo FAS::icon('cog')->pullLeft();
echo FAS::icon('cog')->pullRight();
echo FAS::icon('cog')->flip('horizontal'); // or 'vertical' or 'both'
echo FAS::icon('cog')->size(FAS::SIZE_LARGE); // see FontAwesome::SIZE_ constants for possible values
echo FAS::icon('cog')->transform([
    FAS::TRANSFORM_GROW => 2,
    FAS::TRANSFORM_UP => 5,
    FAS::TRANSFORM_RIGHT => 3
]); // see FontAwesome::TRANSFORM_ constants for possible values
echo FAS::icon('cog')->mask(FAS::i('circle'))->transform(['shrink' => 8]);

//layering icons
echo FAS::layer()
    ->icon(FAS::icon('cog'))
    ->icon(FAS::icon('arrow-up-right-from-square')->transform([
        FAS::TRANSFORM_UP => 8,
        FAS::TRANSFORM_RIGHT => 12,
        FAS::TRANSFORM_SHRINK => 5        
    ]));
bash
php -f ./bin/generate-classes.php
bash
php -f ./bin/generate-classes.php