PHP code example of bugo / fa-icon-builder

1. Go to this page and download the library: Download bugo/fa-icon-builder 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/ */

    

bugo / fa-icon-builder example snippets


// 'fa-brands fa-windows'
echo BrandsIcon::make('windows');

// 'fa-regular fa-user'
echo RegularIcon::make('user');

// 'fa-solid fa-user'
echo SolidIcon::make('user');

// 'fas fa-user'
echo SolidIcon::make('user', true);

$icon = Icon::make('user', IconStyle::Solid);

// '<i class="fa-solid fa-user fa-2xl text-red-500 fa-fw" title="User" aria-hidden="true"></i>'
var_dump(
    $icon
        ->color('text-red-500')
        ->size('2xl')
        ->title('User')
        ->fixedWidth()
        ->ariaHidden()
        ->html()
);

$icon = SolidIcon::make('heart');

// '<i class="fa-solid fa-heart fa-beat"></i>'
var_dump(
    $icon
        ->addClass('fa-beat')
        ->html()
);

var_dump(Icon::random());

var_dump(Icon::collection());

var_dump(Icon::collection(IconStyle::Brands));

var_dump(BrandsIcon::collection());

var_dump(IconBuilder::make(Icon::random()));