All Projects â†’ Pixelrobin â†’ php-feather

Pixelrobin / php-feather

Licence: MIT license
🕊 PHP Library for https://feathericons.com/

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to php-feather

vue-icon
Maybe it is the smallest vue component that contains all the feather icons
Stars: ✭ 44 (+4.76%)
Mutual labels:  icons, feather
vue-feather
Feather component for Vue.js.
Stars: ✭ 108 (+157.14%)
Mutual labels:  icons, feather
majesticons
A versatile, beautiful, and scalable iconset. 760 icons each in line and solid style.
Stars: ✭ 98 (+133.33%)
Mutual labels:  icons
semicon
A collection of icons for the Semantic Web and Linked Open Data world.
Stars: ✭ 20 (-52.38%)
Mutual labels:  icons
minimal-icons
Minimal Icons
Stars: ✭ 21 (-50%)
Mutual labels:  icons
atom-perl6-editor-tools
A collection of useful Perl 6 editor tools
Stars: ✭ 19 (-54.76%)
Mutual labels:  icons
resources-for-web-developers
Resources for Web Developers
Stars: ✭ 77 (+83.33%)
Mutual labels:  icons
beautified-JOSM-preset
Improved version of the JOSM presets
Stars: ✭ 38 (-9.52%)
Mutual labels:  icons
MaterialDesignLight
✒ 250+ Material Design Icons in a Light Style
Stars: ✭ 74 (+76.19%)
Mutual labels:  icons
elm-fontawesome
FontAwesome for Elm.
Stars: ✭ 32 (-23.81%)
Mutual labels:  icons
WeatherIcon
Weather Icon for our API and SDK
Stars: ✭ 98 (+133.33%)
Mutual labels:  icons
perfect-ubuntu
js dev setup, just for fun
Stars: ✭ 14 (-66.67%)
Mutual labels:  icons
svg-chameleon
Easily modify stroke-widths and colors of your SVGs via CSS!
Stars: ✭ 15 (-64.29%)
Mutual labels:  icons
ionicons-sprite
SVG sprite icon set based on Ionicons icons
Stars: ✭ 22 (-47.62%)
Mutual labels:  icons
react-native-paper-tabs
Smooth and fast cross platform Material Design Tabs for React Native Paper
Stars: ✭ 112 (+166.67%)
Mutual labels:  icons
Avalonia.IconPacks
Import of Visual Studio image library and MahApps.Metro.IconPacks for Avalonia
Stars: ✭ 121 (+188.1%)
Mutual labels:  icons
center.js
Center.js is a HTML5 Canvas based library that allows you to create simple text based icons, avatars, logos, and more.
Stars: ✭ 85 (+102.38%)
Mutual labels:  icons
cryptofont
Cryptocurrency icon webfont and SVG
Stars: ✭ 149 (+254.76%)
Mutual labels:  icons
aesto
Free Ghost theme with membership support. Minimal content focused design with multi author supported.
Stars: ✭ 31 (-26.19%)
Mutual labels:  icons
streamlinehq-npm
The deprecated Streamline NPM package, which will be deleted on 1st November 2022.
Stars: ✭ 26 (-38.1%)
Mutual labels:  icons

php-feather

PHP Library for Feather.

For more information on Feather itself, please refer to their README.

Installation

Install php-feather using Composer.

composer require pixelrobin/php-feather

Usage

Icons

Icons are retrieved from an IconManager.

<?php
$icons = new \Feather\IconManager();
?>

<!-- Display the 'anchor' icon -->
<?php echo $icons->getIcon('anchor'); ?>

<!-- Get creative! -->
<button class="icon-button">
    Learn More <?= $icons->getIcon('arrow-right'); ?>
</button>

Feather\IconManager::getIcon() returns an Icon object. To render the icon html itself, either cast the Icon as a string or call its render() function.

$icons->getIcon('anchor'); // Returns an Icon object
$html = $icons->getIcon('anchor')->render(); // Returns the icon's html
echo $icons->getIcon('anchor'); // Outputs the icon's html, since it is cast as a string

Attributes

Attributes can be modified on both the IconManager and on Icon objects. Attributes can be modified directly using the setAttribute(s) functions or by using the helper functions.

Attribute changes on the IconManager will affect all Icon objects created by the IconManager. Changes on Icon objects will only affect the individual icons.

// Use on the IconManager instance to set default attributes for all icons
$icons->setAttributes(['stroke' => '#fff', 'stroke-width' => 2]);
$icons->setAttribute('stroke', '#fff');

$icons->setSize(24);
$icons->setColor('#fff');
$icons->setWeight(2);
$icons->addCssClass('foo');

// Or use on a single icon to only affect that one
echo $icons->getIcon('alert-triangle')->setColor('red')->setAttribute('data-alert', 'true');

Accessibility

When getting an Icon, alt text can be passed as an argument or can be set on the Icon at a later time.

$icons->getIcon('anchor', [], 'Icon of an anchor');

$icon->setAltText('Icon of an anchor');

Aliases

Aliases can be set to make larger changes across a theme easier, such as replacing the actual icon used for a specific use case. For example, what if for the close button icon, you wanted to switch from using the x icon to x-circle. Instead of having the icon name hardcoded, you could use an alias for the use case and update the value in one place. Aliases are set on the IconManager.

$icons->addAlias('close-button', 'x');

Contributing

Feel free to open up issues and PRs for suggestions.

License

Licensed under the MIT License.

The icons in this code are from Feather. It is also licensed under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].