A PHP wrapper for easy Font Awesome 5 icon creation
By default, FaIcon
class gives access to all FontAwesome Pro icons.
$icon = FaIcon::create(FaIcon::COMMENT_SMILE);
There is a helper class for accessing only free icons, using:
$icon = FaIcon::create(FaFreeIcons::ROCKET);
Whilst FaIcon::create();
will work for creating Brand icons, the below class static is for improved code readability of developer intent.
$brandIcon = FaBrandIcon::create(FaBrandIcon::GOOGLE);
$icon->sizeLarge();
$icon->sizeSmall();
$icon->sizeXSmall();
$icon->sizeX1();
$icon->sizeX2();
$icon->sizeX3();
$icon->sizeX4();
$icon->sizeX5();
$icon->sizeX6();
$icon->sizeX7();
$icon->sizeX8();
$icon->sizeX9();
$icon->sizeX10();
$icon->styleRegular();
$icon->styleLight();
$icon->styleSolid();
$icon->flip(FaFlip::VERTICAL);
$icon->flip(FaFlip::HORIZONTAL);
Multiple flips:
$icon->flip(FaFlip::VERTICAL, FaFlip::HORIZONTAL);
$icon->shrink(10);
$icon->grow(10);
$icon->moveUp(10);
$icon->moveDown(10);
$icon->moveLeft(10);
$icon->moveRight(10);
$icon->mask(FaIcon::PENCIL_ALT, FaStyle::SOLID);
$icon->spin();
$icon->pulse();
$icon->span();
$icon->fixedWidth();
$icon->border();
$icon->pullLeft();
$icon->pullRight();
Icon object is created using Glimpse.
Add/remove classes:
$icon->addClass('someClass', 'anotherClass');
$icon->removeClass('remveThis', 'andThis');
Get Icon Glimpse object and apply custom attributes:
$icon->glimpse()->setId('uniqueId');
$icon->glimpse()->setAttribute('data-whatever', 'someValue');