onix-systems-php/blade-icons

An easy way inline SVG images in your Blade templates.

v1.0.0 2023-12-07 14:19 UTC

This package is auto-updated.

Last update: 2024-04-07 16:31:51 UTC


README

Implements orchidsoftware/blade-icons for Hyperf.

Installation

To install this package, run the following command in your command line:

$ composer require onix-systems-php/blade-icons

Basic Usage

Publish config:

php bin/hyperf.php vendor:publish onix-systems-php/blade-icons

Add to config/autoload/view.php

'components' => [
    'hyperf-icon' => \OnixSystemsPHP\HyperfIcons\Component\IconComponent::class,
],

When calling the directory method with the first argument, we pass the prefix to call our icons and the second argument is the directory where they are located.

After that, we can call the component in our blade templates:

<x-hyperf-icon path="fa.home" />

If you use one or two sets of icons that do not repeat, then it is not necessary to specify a prefix in the component:

<x-hyperf-icon path="home" />

You can also list some attributes that should be applied to your icon:

<x-hyperf-icon 
    path="home" 
    class="icon-big" 
    width="2em" 
    height="2em" />

License

The MIT License (MIT). Please see License File for more information.