Skip to content

Commit d6399eb

Browse files
author
Maxim Vanhove
committed
Update documentation
1 parent ab18e1c commit d6399eb

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

readme.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Font Awesome SVG - PHP
22

3-
A PHP class that can be used to add [Font Awesome 5+](https://fontawesome.com/)'s SVG icons inline without Javascript.
3+
A PHP class that can be used to add [Font Awesome 6+](https://fontawesome.com/)'s SVG icons inline without Javascript.
44

55
## Installation
66

@@ -26,37 +26,37 @@ Or you can download the `FontAwesomeSVG.php` file and include it manually.
2626
// $dir = directory where SVG files are
2727
$FA = new FontAwesomeSVG($dir);
2828

29-
echo $FA->get_svg('fas fa-file');
29+
echo $FA->get_svg('fa-solid fa-file');
3030
```
3131

3232
Add custom classes:
3333

3434
```php
35-
echo $FA->get_svg('fas fa-file', ['class' => 'my-custom-class another-class']);
35+
echo $FA->get_svg('fa-solid fa-file', ['class' => 'my-custom-class another-class']);
3636
```
3737

3838
Remove default class `.svg-inline--fa`:
3939

4040
```php
41-
echo $FA->get_svg('fas fa-file', ['default_class' => false]);
41+
echo $FA->get_svg('fa-solid fa-file', ['default_class' => false]);
4242
```
4343

4444
Change `<path>` fill (default is `currentColor`):
4545

4646
```php
47-
echo $FA->get_svg('fas fa-file', ['fill' => '#f44336']);
47+
echo $FA->get_svg('fa-solid fa-file', ['fill' => '#f44336']);
4848
```
4949

5050
Add `<title></title>`:
5151

5252
```php
53-
echo $FA->get_svg('fas fa-file', ['title' => 'My accessible icon']);
53+
echo $FA->get_svg('fa-solid fa-file', ['title' => 'My accessible icon']);
5454
```
5555

5656
Multiple options at once:
5757

5858
```php
59-
echo $FA->get_svg('fas fa-file', [
59+
echo $FA->get_svg('fa-solid fa-file', [
6060
'class' => 'my-custom-class another-class',
6161
'default_class' => false,
6262
'title' => 'My title',
@@ -68,7 +68,7 @@ echo $FA->get_svg('fas fa-file', [
6868
Customise duotone icons:
6969

7070
```php
71-
echo $FA->get_svg('fad fa-laugh-wink', [
71+
echo $FA->get_svg('fa-duotone fa-laugh-wink', [
7272
'primary' => [
7373
'fill' => '#e64980',
7474
],
@@ -95,6 +95,16 @@ echo $FA->get_svg('fad fa-laugh-wink', [
9595

9696
> Requires **v5.10.0** or greater, and a FontAwesome Pro license
9797
98+
## Sharp
99+
100+
> Requires **v6.4.0** or greater, and a FontAwesome Pro license
101+
102+
```php
103+
echo $FA->get_svg('fa-sharp fa-light fa-file');
104+
echo $FA->get_svg('fa-sharp fa-regular fa-file');
105+
echo $FA->get_svg('fa-sharp fa-solid fa-file');
106+
```
107+
98108
### options
99109

100110
If `inline_style` is enabled, the value of `fill` and `opacity` are also used in the inline style on `<svg>` tag.
@@ -149,6 +159,24 @@ echo $FA->get_svg('fad fa-laugh-wink', [
149159
]);
150160
```
151161

162+
## Aliases
163+
164+
The short aliases from version 5 are still supported
165+
166+
```php
167+
echo $FA->get_svg('fab fa-twitter');
168+
echo $FA->get_svg('fad fa-file');
169+
echo $FA->get_svg('fal fa-file');
170+
echo $FA->get_svg('far fa-file');
171+
echo $FA->get_svg('fas fa-file');
172+
173+
// And the new shorthands for thin and sharp
174+
echo $FA->get_svg('fat fa-file'); // thin
175+
echo $FA->get_svg('fasl fa-file'); // sharp-light
176+
echo $FA->get_svg('fasr fa-file'); // sharp-regular
177+
echo $FA->get_svg('fass fa-file'); // sharp-solid
178+
```
179+
152180
## Accessibility
153181

154182
The below is implemented based on:
@@ -169,7 +197,7 @@ The below is implemented based on:
169197
You can set a `<title>`, an `id` for the `<title>` and the `aria-labelledby` attribute will be added automatically:
170198

171199
```php
172-
echo $FA->get_svg('fas fa-file', [
200+
echo $FA->get_svg('fa-solid fa-file', [
173201
'title' => 'File',
174202
'title_id' => 'file-id',
175203
]);
@@ -186,7 +214,7 @@ echo $FA->get_svg('fas fa-file', [
186214
You can add any aria-\* attribute to the SVG tag:
187215

188216
```php
189-
echo $FA->get_svg('fas fa-file', [
217+
echo $FA->get_svg('fa-solid fa-file', [
190218
'aria-label' => 'File',
191219
]);
192220
```
@@ -200,7 +228,7 @@ echo $FA->get_svg('fas fa-file', [
200228
`aria-hidden="true"` is added to the SVG tag by default unless `<title id="">` (and `aria-labelledby`) or `aria-label` is set.
201229

202230
```php
203-
echo $FA->get_svg('fas fa-file');
231+
echo $FA->get_svg('fa-solid fa-file');
204232
```
205233

206234
```html

0 commit comments

Comments
 (0)