PHP code example of xicrow / php-icons

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

    

xicrow / php-icons example snippets


// FontAwesome 4
echo \Xicrow\PhpIcons\FontAwesome4::Icon(\Xicrow\PhpIcons\FontAwesome4::Icon_Thumbs_Up);

// FontAwesome 5
echo \Xicrow\PhpIcons\FontAwesome5::Icon(\Xicrow\PhpIcons\FontAwesome5::Icon_Thumbs_Up);

echo BaseIcon::Icon(ICON_IDENTIFIER);

echo BaseIcon::Icon(ICON_IDENTIFIER, ICON_MODIFIER, ICON_MODIFIER);

echo BaseIcon::Icon(ICON_IDENTIFIER)
    ->modify(ICON_MODIFIER)
    ->modify(ICON_MODIFIER)
;

echo BaseIcon::Icon(ICON_IDENTIFIER)
    ->modify(ICON_MODIFIER)
    ->modify(ICON_MODIFIER)
    ->attribute('title', 'Nifty help text')
    ->attribute('style', 'color: blue;')
;

// Made-up constants
$oStatusIcon = BaseIcon::Icon(BaseIcon::Icon_Bullet, BaseIcon::Modifier_Size_X2);
// Looping a resultset
foreach ($arrResults as $oResult) {
    // Clone the status icon, set color from result, and render
    echo (clone $oStatusIcon)->attribute('style', 'color: '.$oResult->strStatusColor.';');
}

class FA extends \Xicrow\PhpIcons\FontAwesome5 {}

echo FA::Icon(FA::Icon_Thumbs_Up, FA::Modifier_Lg);

class FA extends \Xicrow\PhpIcons\FontAwesome5 {
    public static function IconCreate(): self
    {
        return static::Icon(static::Icon_Plus_Circle)->attribute('style', 'color: green;');
    }

    public static function IconEdit(): self
    {
        return static::Icon(static::Icon_Pencil)->attribute('style', 'color: blue;');
    }

    public static function IconDelete(): self
    {
        return static::Icon(static::Icon_Trash)->attribute('style', 'color: red;');
    }
}

echo FA::IconCreate();

composer