https://github.com/inteve/icons
Icons loader for web-apps.
https://github.com/inteve/icons
assets icons icons-provider php
Last synced: 3 months ago
JSON representation
Icons loader for web-apps.
- Host: GitHub
- URL: https://github.com/inteve/icons
- Owner: inteve
- License: other
- Created: 2022-09-20T09:04:44.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-19T07:20:54.000Z (over 1 year ago)
- Last Synced: 2025-01-13T08:12:24.603Z (5 months ago)
- Topics: assets, icons, icons-provider, php
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license.md
Awesome Lists containing this project
README
# Inteve\Icons
[](https://github.com/inteve/icons/actions)
[](https://packagist.org/packages/inteve/icons)
[](https://github.com/inteve/icons/releases)
[](https://github.com/inteve/icons/blob/master/license.md)Icons loader for web-apps.
## Installation
[Download a latest package](https://github.com/inteve/icons/releases) or use [Composer](http://getcomposer.org/):
```
composer require inteve/icons
```Inteve\Icons requires PHP 7.4.0 or later.
## Usage
This library is implementation of [PHIG's](https://github.com/phig-org/phig) `HtmlIcons` interface.
### InlineSvgIcons
``` php
$icons = new \Inteve\Icons\InlineSvgIcons($iconsDirectory);
echo $icons->get('my-icon'); // finds file "$iconsDirectory/my-icon.svg", prints ...
```### ImgIcons
``` php
$icons = new \Inteve\Icons\ImgIcons($publicUrlPath, $fileExtension, $htmlClass = 'icon');
echo $icons->get('my-icon'); // prints![]()
echo $icons->get('my-icon@small'); // prints![]()
```### InlineStyleIcons
``` php
$icons = new \Inteve\Icons\InlineStyleIcons($publicUrlPath, $fileExtension, $htmlClass = 'icon', $tagName = 'i');
echo $icons->get('my-icon'); // prints
echo $icons->get('my-icon@small'); // prints
```### WrappedIcons
``` php
$svgIcons = new \Inteve\Icons\InlineSvgIcons($iconsDirectory);
$icons = new \Inteve\Icons\WrappedIcons($svgIcons, $className = 'icon', $tagName = 'i');
echo $icons->get('my-icon'); // prints ...
echo $icons->get('my-icon@small'); // prints ...
```### PrefixedIcons
``` php
$icons = new \Inteve\Icons\PrefixedIcons(
icons: [
'legacy' => new ImgIcons($publicUrlPath, $fileExtension),
'bootstrap' => new \Inteve\Icons\InlineSvgIcons($bootstrapIconsDirectory),
],
defaultIcons: new \Inteve\Icons\InlineSvgIcons($iconsDirectory)
);
echo $icons->get('my-icon'); // prints ...
echo $icons->get('legacy/my-icon'); // prints![]()
echo $icons->get('bootstrap/my-icon'); // prints ...
```------------------------------
License: [New BSD License](license.md)
Author: Jan Pecha, https://www.janpecha.cz/