armin / font-awesome-bundle
Symfony bundle to provide Font Awesome svg icons as inline svg sprite.
Installs: 291
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 3
Type:symfony-bundle
Requires
- php: >=7.2.0
- ext-dom: *
- fortawesome/font-awesome: ^5.13
- symfony/framework-bundle: ^4.0 | ^5.0
- symfony/twig-bridge: ^4.0 | ^5.0
This package is auto-updated.
Last update: 2024-10-29 23:12:37 UTC
README
This bundle for Symfony Framework, allows you to add FontAwesome SVG icons, inline in your html.
It is released under MIT license.
Installation
To install this package, you can just use composer:
$ composer require armin/font-awesome-bundle
This will also require the fortawesome/font-awesome package.
Please make sure, you've registred the bundle correctly in your project's config/bundles.php
.
There is no configuration to be made.
Features
- Embed FontAwesome svg icons in our html output
- Without need of any CSS or JavaScript include
- Usage of SVG sprites:
- When the same icon is used several times on the same page (e.g. arrow icons), every additional instance of this icon will point to the first occurence in html output
- Each instance can have individual options, like size or color
- This saves space, in html output
- No need to copy/symlink SVG assets from
vendor/
topublic/
Usage
Once this bundle is installed, you can use the following Twig function:
{{ fa("smile-beam") }} == {{ fa("fas smile-beam") }}
{{ fa("far smile-beam") }}
{{ fa("far smile-beam", {size: 256, color: '#d50', class: 'card shadow'}) }}
It is recommended, to add some default CSS.
All icons in html output, will have got the class fa-svg-icon
set:
.fa-svg-icon {
width: 32px;
height: 32px;
fill: #444;
}
When you provide options, like size or color, inline styles will overwrite the default CSS.
Support
If you like this Symfony bundle, you are invited to donate some funds to support further development. Thank you!
For help please visit the issue section on Github.