Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.

Commit 21e769c

Browse files
author
Nate Wiebe
committed
Update readme to match changes
1 parent 9f63f73 commit 21e769c

File tree

1 file changed

+14
-30
lines changed

1 file changed

+14
-30
lines changed

README.md

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,17 @@ require 'vendor/autoload.php';
3030

3131
### Get an icon
3232

33-
Icons echo by default.
34-
3533
```php
3634
<?php
3735
require 'vendor/autoload.php';
38-
$icons = new Feather\Icons;
36+
$icons = new Feather\Icons();
3937
?>
4038

4139
<!-- Display the 'anchor' icon !-->
42-
<?php $icons->get('feather'); ?>
40+
<?php echo $icons->get('feather'); ?>
4341

4442
<!-- Get creative! !-->
45-
<button class="icon-button">Learn More <?php $icons->get('arrow-right'); ?></button>
43+
<button class="icon-button">Learn More <?php echo $icons->get('arrow-right'); ?></button>
4644
```
4745

4846
### Get an icon with modified properties
@@ -67,45 +65,32 @@ $icons->get('mail');
6765
// <svg ... color="red" stroke-width="3" ... >...</svg>
6866
```
6967

70-
### Get an icon as a string
71-
72-
Set the third argument to `false` to get a string instead of echoing the icon.
73-
74-
```php
75-
$icon_string = $icons->get('activity', array(), false);
76-
// Then do whatever with $icon_string
77-
```
78-
7968
## API
8069

8170
### `Feather\Icons`
8271

8372
Usage:
8473

8574
```php
86-
$icons = new Feather\Icons;
75+
$icons = new Feather\Icons();
8776
```
8877

8978
<br>
9079

91-
### `Feather\Icons->get($name, $attributes = array(), $echo = true)`
80+
### `Feather\Icons->get($name, $attributes = array())`
9281

93-
Gets an icon as svg. Can be echoed (default) or returned as a string. Attributes passed will be merged over the class defaults.
82+
Gets an icon as a string. Attributes passed will be merged over the class defaults.
9483

9584
```php
96-
$icons = new Feather\Icons;
85+
$icons = new Feather\Icons();
9786

98-
// Echo an icon
99-
$icons->get('anchor');
87+
// Get an icon
88+
echo $icons->get('anchor');
10089
// <svg ... >...</svg>
10190

102-
// Echo an icon with modified properties
103-
$icons->get('battery', array('class' => 'fooclass', 'stroke-width' => 1, 'aria-label' => 'Battery icon'));
91+
// Get an icon with modified properties
92+
echo $icons->get('battery', array('class' => 'fooclass', 'stroke-width' => 1, 'aria-label' => 'Battery icon'));
10493
// <svg ... class="feather feather-battery fooclass", stroke-width="1", aria-label="Battery icon" ... >...</svg>
105-
106-
// Get an icon as a string without echoing it
107-
$cloud_icon = $icons->get('cloud', array(), false);
108-
doStuffWith($cloud_icon);
10994
```
11095

11196
#### Arguments
@@ -114,7 +99,6 @@ doStuffWith($cloud_icon);
11499
|------------|-------|---------------------------------------------------------------------------------|
115100
|$name |string |The name of the icon. A full list can be found [here](https://feathericons.com/).|
116101
|$attributes?|array |Attributes to modify/add (see 'Usage' above for example) |
117-
|$echo? |boolean|Whether to echo the icon svg (true) or not (false) |
118102

119103
<br>
120104

@@ -124,7 +108,7 @@ Sets default attributes of the class. These are used as default attributes for t
124108
disable this by setting the `$merge` argument to false, but only do it if you know what you are doing.
125109

126110
```php
127-
$icons = new Feather\Icons;
111+
$icons = new Feather\Icons();
128112

129113
// Set some default attributes (this will be merged with the current defaults in the class)
130114
$icons->setAttributes(array('color' => 'red', 'stroke-width' => 3));
@@ -148,7 +132,7 @@ $icons->get('delete');
148132
Get the current attributes for the class. To set it, use the `setAttributes()` method;
149133

150134
```php
151-
$icons = new Feather\Icons;
135+
$icons = new Feather\Icons();
152136

153137
$attrs = $icons->getAttributes();
154138
```
@@ -160,7 +144,7 @@ $attrs = $icons->getAttributes();
160144
Constant array of default attributes. They are applied to every new `Icons` class. You can use this to reset the attributes of an `Icons` class.
161145

162146
```php
163-
$icons = new Feather\Icons;
147+
$icons = new Feather\Icons();
164148

165149
// Add/modify some default attributes
166150
$icons->setAttributes( ... );

0 commit comments

Comments
 (0)