Download the PHP package husseinalhammad/fontawesome-svg without Composer
On this page you can find all versions of the php package husseinalhammad/fontawesome-svg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download husseinalhammad/fontawesome-svg
More information about husseinalhammad/fontawesome-svg
Files in husseinalhammad/fontawesome-svg
Package fontawesome-svg
Short Description PHP class to add Font Awesome 5+'s SVG icons inline without Javascript.
License MIT
Homepage https://github.com/husseinalhammad/FontAwesomeSVG-PHP
Informations about the package fontawesome-svg
Font Awesome SVG - PHP
A PHP class that can be used to add Font Awesome 6+'s SVG icons inline without Javascript.
Installation
You can install it using Composer:
Or you can download the FontAwesomeSVG.php
file and include it manually.
Usage
Files
- Download Font Awesome (Free or Pro)
- Get the folder
advanced-options/raw-svg
and place it in your project - Add
svg-with-js/css/fa-svg-with-js
to your document (or write your own CSS)
Examples
Add custom classes:
Remove default class .svg-inline--fa
:
Change <path>
fill (default is currentColor
):
Add <title></title>
:
Multiple options at once:
Customise duotone icons:
Option | What it means |
---|---|
class | Adds classes to the SVG tag |
default_class | If set to false , the default CSS class won't be added to the SVG tag. Deafult: true . |
inline_style | Whether to add duotone styles as inline style to the <svg> tag. Deafult: true . |
title | Adds a <title> inside the SVG tag for semantic icons |
title_id | Adds an id attribute to <title> and adds aria-labelledby on the SVG tag with the same value |
role | The value of the role attribute in the SVG tag. Default: img |
fill | The value of the fill attribute in the <path> inside the SVG. Default: currentColor |
primary | Duotone primary options (see table below) |
secondary | Duotone secondary options (see table below) |
Duotone
Requires v5.10.0 or greater, and a FontAwesome Pro license
Sharp
Requires v6.4.0 or greater, and a FontAwesome Pro license
options
If inline_style
is enabled, the value of fill
and opacity
are also used in the inline style on <svg>
tag.
Option | What it means |
---|---|
fill | The value of the fill attribute in the <path> inside the SVG. Default: currentColor |
opacity | The value of the opacity attribute in the <path> inside the SVG. |
Examples:
Single colour:
Swapping Layer Opacity:
Single colour with custom opacity:
Custom colours and opacity:
Aliases
The short aliases from version 5 are still supported
Accessibility
The below is implemented based on:
- Font Awesome's Accessibility docs
- Heather Migliorisi's article on CSS-Tricks Accessible SVGs
role
attribute
role="img"
is added to the SVG tag by default:
<title>
, aria-labelledby
You can set a <title>
, an id
for the <title>
and the aria-labelledby
attribute will be added automatically:
aria-*
attributes
You can add any aria-* attribute to the SVG tag:
aria-hidden
attribute
aria-hidden="true"
is added to the SVG tag by default unless <title id="">
(and aria-labelledby
) or aria-label
is set.