packaged-ui / fontawesome
Fontawesome icon creation helper
Installs: 10 216
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- packaged/enum: ~1.0
- packaged/glimpse: ^0.8||^1.0||^2.0
- packaged/helpers: ^1.0||^2.0
- packaged/safehtml: ^1.0||^2.0
Requires (Dev)
- fortawesome/font-awesome: ^5.7
- phpunit/phpunit: ^5.7.0
- symfony/yaml: 4.1.4
This package is auto-updated.
Last update: 2024-10-08 07:57:04 UTC
README
A PHP wrapper for easy Font Awesome 5 icon creation
Example
Create Icon:
By default, FaIcon
class gives access to all FontAwesome Pro icons.
$icon = FaIcon::create(FaIcon::COMMENT_SMILE);
For Free icons:
There is a helper class for accessing only free icons, using:
$icon = FaIcon::create(FaFreeIcons::ROCKET);
Create Brand Icon:
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);
Size options:
$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();
Style options (pro only):
$icon->styleRegular(); $icon->styleLight(); $icon->styleSolid();
Transformation options:
Flip:
$icon->flip(FaFlip::VERTICAL); $icon->flip(FaFlip::HORIZONTAL);
Multiple flips:
$icon->flip(FaFlip::VERTICAL, FaFlip::HORIZONTAL);
Shrink / Grow:
$icon->shrink(10); $icon->grow(10);
Move:
$icon->moveUp(10); $icon->moveDown(10); $icon->moveLeft(10); $icon->moveRight(10);
Mask:
$icon->mask(FaIcon::PENCIL_ALT, FaStyle::SOLID);
Animation options:
$icon->spin(); $icon->pulse();
Set tag as span (more semantic than default <i>
tag):
$icon->span();
Other options:
$icon->fixedWidth();
$icon->border();
$icon->pullLeft(); $icon->pullRight();
Additional:
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');